-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (54 loc) · 1.91 KB
/
generate-files.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
# This action will create generated files, and is done whenever the main branch is updated.
#
# For documentation on the github environment, see
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
#
# For documentation on the syntax of this file, see
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Build
on:
push:
branches: [ main ]
permissions:
contents: read
jobs:
generate-files:
permissions:
contents: write # for Git to git push
pull-requests: write # for Git to create a pull request
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Generate files
working-directory: ${{github.workspace}}
run: |
python registry_tools/syncstandard.py
python registry_tools/makeTSV.py
python registry_tools/makeJSON.py
- name: Set git config
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)"
git config -l
- name: Check for diffs
id: diff
run: |
git diff --quiet origin/main . || echo "::set-output name=status::changes"
shell: bash
- name: Create Pull Request
if: steps.diff.outputs.status == 'changes'
run: |
git checkout -b generated-files
git add .
git commit -m "Update generated files"
git push -f origin generated-files
if ! gh pr list | grep -q "generated-files"; then
gh pr create -B main -H generated-files --title 'Update generated files' --body $'Update generated files\nThis PR is auto-generated by [gh pr create].' --label 'automated pr'
fi
env:
GH_TOKEN: ${{ github.token }}