Skip to content

Periodic Updates

Periodic Updates #3998

Workflow file for this run

name: Periodic Updates
on:
schedule:
- cron: '* 8 * * *'
workflow_dispatch:
inputs:
ref:
default: 'auto-update-bot'
required: false
type: string
jobs:
periodic-update:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
# This allows us to continue to update an existing auto-update branch if it has yet to be merged, but if one
# does not exist we will create a new one from the main branch.
- id: repo
shell: bash
run: |
if git ls-remote --heads --quiet --exit-code https://github.com/${{ github.repository }}.git ${{ inputs.ref }}
then
echo "::notice::Checkout: ${{ github.repository }} using ${{ inputs.ref }}"
echo "name=ref-exists::true" >> $GITHUB_OUTPUT
else
USING="main"
echo "::notice::Checkout: ${{ github.repository }} does not have ref ${{ inputs.ref }} (fallback to ${USING})"
echo "name=ref-exists::false" >> $GITHUB_OUTPUT
echo "name=default-branch::${USING}" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.ref }}
- name: Cache Ruby Gems and Bundle
id: cache-gems
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-build-ruby-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-build-ruby-
- name: Set up Ruby 4.0.5
uses: ruby/setup-ruby@v1
with:
ruby-version: 4.0.5
bundler-cache: true
- name: Cache Temporary Data
id: cache-tmp
uses: actions/cache@v4
with:
path: tmp
key: data-update-cache
- name: Perform Default Rake Task
run: bundle exec rake update
- name: Archive Data Artifacts
uses: actions/upload-artifact@v4
with:
name: data-update-artifacts
path: _data
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply data updates
create_branch: true
branch: ${{ inputs.ref }}
commit_user_name: The Hack Different fully sentient AI
file_pattern: _data/**
push_options: '--force'
- name: pull-request
uses: repo-sync/pull-request@v2
with:
destination_branch: main
source_branch: ${{ inputs.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: "Automated Data Update: ${{ github.run_number }}"
ci-test:
needs: periodic-update
uses: hack-different/apple-knowledge/.github/workflows/build-test.yml@main
ci-build-jekyll:
needs: ci-test
uses: hack-different/apple-knowledge/.github/workflows/build-jekyll.yml@main
ci-build-python:
needs: ci-test
uses: hack-different/apple-knowledge/.github/workflows/build-python.yml@main
ci-build-ruby:
needs: ci-test
uses: hack-different/apple-knowledge/.github/workflows/build-ruby.yml@main
ci-build-node:
needs: ci-test
uses: hack-different/apple-knowledge/.github/workflows/build-node.yml@main