Skip to content

ci: route changelog push through BOT_TOKEN PAT#78

Merged
duzos merged 3 commits into
masterfrom
ci/changelog-restore-bot-token
May 7, 2026
Merged

ci: route changelog push through BOT_TOKEN PAT#78
duzos merged 3 commits into
masterfrom
ci/changelog-restore-bot-token

Conversation

@duzos

@duzos duzos commented May 7, 2026

Copy link
Copy Markdown
Owner

About the PR

Follow-up to #77. The GITHUB_TOKEN swap landed but the post-merge dispatch then died at git push because the PRS ONLY ruleset on master requires a PR. The built-in github-actions integration cannot be added as a bypass actor for that ruleset (GitHub rejects with "must be part of the ruleset source or owner organization"). BOT_TOKEN has been regenerated and belongs to a member of the existing bypass team, so it can push directly. This PR routes auth back through BOT_TOKEN while keeping every other fix from #77.

Why / Balance

No gameplay impact - CI only. Restores the post-merge Update Changelog workflow to a working state so changelog backfill can proceed.

Technical details

  • secrets.GITHUB_TOKEN -> secrets.BOT_TOKEN on the actions/checkout step, the updater env, and the push step
  • Drop the permissions: block - it only constrained GITHUB_TOKEN and we no longer use it
  • Restore the https://x-access-token:${TOKEN}@github.com/... push URL pattern
  • Restore the github-bot git config identity (matches prior commit metadata; the actual pusher in the audit log is the PAT owner regardless)
  • Keep the post-ci: fix changelog workflow auth and push target #77 improvements: ref: master on checkout, push to master explicitly, no-op skip when the diff is empty, and the workflow-level concurrency group

Media

N/A - CI only.

Requirements

Breaking changes

None.

Backfill plan (post-merge)

After this merges:

gh workflow run "Update Changelog" --repo amblelabs/superhero -f pr_numbers="66,67,68,69,70,71,74,76,77"

GITHUB_TOKEN is blocked by the PRS-ONLY ruleset on master and the
github-actions integration cannot be added as a bypass actor (must
be installed at org level). Switch back to BOT_TOKEN, which belongs
to a member of the bypass team and can push directly. Keep the
post-#77 fixes: ref:master on checkout, push to master explicitly,
no-op skip, and the concurrency group.
Copilot AI review requested due to automatic review settings May 7, 2026 18:08
@duzos duzos added bug Something isn't working C: No Java Changes: Requires no Java knowledge to review or fix this item. labels May 7, 2026
@github-actions github-actions Bot added the S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. label May 7, 2026
@duzos duzos self-assigned this May 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Routes the “Update Changelog” GitHub Actions workflow back through a PAT-based BOT_TOKEN so the workflow can git push to master despite the “PRS ONLY” ruleset, restoring automated changelog backfill after merges.

Changes:

  • Swaps actions/checkout and the changelog updater environment from secrets.GITHUB_TOKEN to secrets.BOT_TOKEN.
  • Removes the job-level permissions: block (no longer relevant when not relying on GITHUB_TOKEN).
  • Pushes via an authenticated https://x-access-token:${TOKEN}@github.com/... URL and restores the github-bot git identity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 26 to 32
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.BOT_TOKEN }}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2f93d02 — switched the trigger to pull_request_target. Verified: this runs in the base-repo context (so secrets are exposed for fork-PR merges), and since we already ref: master on checkout we never run code from the PR head, which keeps the usual pull_request_target risk closed off.

pull_request workflows do not receive secrets when triggered by a
PR from a fork, even on the closed/merged event, so external
contributions would silently skip changelog updates. switch to
pull_request_target - safe here since we check out ref:master and
never run code from the PR head.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

.github/workflows/append_changelog.yml:24

  • The workflow trigger was switched to pull_request_target, but the job if: condition still checks github.event_name == 'pull_request'. For merged PRs this will now evaluate false (event name will be pull_request_target), so the job won’t run and the changelog won’t be updated. Update the condition to match pull_request_target (and keep the merged check).
    # only proceed if merge event or manual run
    if: |
      (github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
      (github.event_name == 'workflow_dispatch')

trigger swap in 2f93d02 left the gate checking event_name=='pull_request',
which never matches now and would skip the job on every merge. match the
new event name.
@duzos

duzos commented May 7, 2026

Copy link
Copy Markdown
Owner Author

Caught the if-condition mismatch from the suppressed-confidence comment too — pushed 90b74a7 updating the gate to event_name == 'pull_request_target' so the job actually fires on merge. Without it the trigger swap would have silently skipped every merge.

@duzos duzos requested a review from Copilot May 7, 2026 18:20
@duzos duzos merged commit 53b6392 into master May 7, 2026
2 checks passed
@duzos duzos deleted the ci/changelog-restore-bot-token branch May 7, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment on lines 26 to 45
@@ -44,19 +41,21 @@ jobs:
- name: Run changelog updater
env:
GITHUB_REPOSITORY: ${{ github.repository }}
BOT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
GITHUB_EVENT_PATH: ${{ github.event_path }}
Comment on lines 49 to +61
- name: Commit & push
env:
TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-bot"
git config user.email "bot@users.noreply.github.com"
git add CHANGELOG.md
if git diff --cached --quiet; then
echo "No changelog changes to commit."
exit 0
fi
git commit -m "docs: update CHANGELOG"
git push origin HEAD:master No newline at end of file
git push https://x-access-token:${TOKEN}@github.com/${{ github.repository }} HEAD:master No newline at end of file
Comment on lines 18 to 24
jobs:
append-changelog:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
# only proceed if merge event or manual run
if: |
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
(github.event_name == 'pull_request_target' && github.event.pull_request.merged == true) ||
(github.event_name == 'workflow_dispatch')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working C: No Java Changes: Requires no Java knowledge to review or fix this item. S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants