Skip to content

Update generated files (#81) #63

Update generated files (#81)

Update generated files (#81) #63

# 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 }}