-
Notifications
You must be signed in to change notification settings - Fork 72
107 lines (90 loc) · 3.13 KB
/
update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-build-ruby-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-build-ruby-
- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true
- name: Cache Temporary Data
id: cache-tmp
uses: actions/cache@v3
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@v3
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