Data updates: open the PR with ATLAS_BOT_TOKEN and auto-merge it once CI passes (#7)
Changes made with GITHUB_TOKEN do not start other workflows, so a merged data PR would not redeploy the site. With the ATLAS_BOT_TOKEN secret the workflow opens the PR with it and turns on auto-merge; without it, it falls back to GITHUB_TOKEN and a manual merge. docs/REPO_SETTINGS.md lists the settings only the owner can change (auto-merge, the ruleset for main, the token). Refs #4, #5, #6 Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2b905b4a84
commit
dcd5117373
@@ -10,6 +10,9 @@ permissions:
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# secrets cannot be tested in `if:` directly
|
||||
HAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN != '' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
@@ -27,16 +30,26 @@ jobs:
|
||||
node scripts/build-graph.js
|
||||
npm run policy
|
||||
npm test
|
||||
# The PR is opened with ATLAS_BOT_TOKEN (a fine-grained token, see docs/REPO_SETTINGS.md) when it is set:
|
||||
# changes made with the built-in GITHUB_TOKEN do not start other workflows, so its merge would not
|
||||
# redeploy the site. Without the secret it falls back to GITHUB_TOKEN and the PR waits for a manual merge.
|
||||
- name: Open a pull request with the new data
|
||||
id: pr
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
token: ${{ secrets.ATLAS_BOT_TOKEN || github.token }}
|
||||
branch: data/source-update
|
||||
delete-branch: true
|
||||
commit-message: "data: update from community sources"
|
||||
title: "New data from the community sources"
|
||||
body-path: ${{ runner.temp }}/report.md
|
||||
labels: data
|
||||
- name: Merge it automatically once CI passes
|
||||
if: steps.pr.outputs.pull-request-number != '' && env.HAS_BOT_TOKEN == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
run: gh pr merge "${{ steps.pr.outputs.pull-request-number }}" --auto --squash
|
||||
- name: Report a broken source link
|
||||
if: steps.check.outputs.failed != ''
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user