Update schema #315
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update schema | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 16 * * 2" # Every Tuesday at 4pm UTC (8am PST, 9am PDT) | |
jobs: | |
update: | |
if: github.repository == 'aws/serverless-application-model' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Update schema | |
id: schema | |
run: | | |
make init | |
make schema-all | |
# Sets condition steps.schema.outputs.changed to true if anything changed | |
git diff --exit-code || echo "changed=true" >> $GITHUB_OUTPUT | |
- name: Push change to temporary branch | |
if: steps.schema.outputs.changed | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git checkout -b tmp/schema/$GITHUB_RUN_ID/$GITHUB_RUN_ATTEMPT | |
git add -u | |
git commit -m "chore(schema): update" | |
git push --set-upstream origin tmp/schema/$GITHUB_RUN_ID/$GITHUB_RUN_ATTEMPT | |
- name: Create PR | |
if: steps.schema.outputs.changed | |
run: printf '> **Note**\n> If checks do not start, close then reopen this pull request.\n\nCreated by the [`schema.yml`](https://github.com/aws/serverless-application-model/blob/develop/.github/workflows/schema.yml) workflow.\n' | gh pr create --fill --base develop --body-file - | |
env: | |
GH_TOKEN: ${{ github.token }} |