Skip to content

ci: fix changelog workflow auth and push target#77

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

ci: fix changelog workflow auth and push target#77
duzos merged 3 commits into
masterfrom
ci/fix-changelog-token

Conversation

@duzos

@duzos duzos commented May 7, 2026

Copy link
Copy Markdown
Owner

About the PR

The post-merge Update Changelog workflow has been failing on every merge since #66 because checkout is rejected with fatal: could not read Username for 'https://github.com' - the BOT_TOKEN secret no longer authenticates. This swaps it to the built-in GITHUB_TOKEN, fixes the push target, and only commits when the changelog actually changed.

Why / Balance

No gameplay impact - CI only. The merged PRs that ran while the workflow was broken (#66, #67, #68, #69, #70, #71, #74, #76) never had their changelog entries appended. Once this lands the workflow can be re-dispatched manually with that PR list to backfill CHANGELOG.md.

Technical details

  • secrets.BOT_TOKEN -> secrets.GITHUB_TOKEN (the bot token is dead; the runner-issued token works and rotates per-run)
  • permissions: contents: write on the job, since GITHUB_TOKEN is read-only by default for pull_request events
  • ref: master on the checkout: when a PR closes, github.ref points at refs/pull/N/merge, so without this the runner checks out the merge ref and the push target is wrong
  • Push target hardcoded to origin HEAD:master instead of ${{ github.ref }}
  • Bot identity moved to github-actions[bot] (canonical for GITHUB_TOKEN-attributed commits)
  • Skip the commit step entirely when the diff is empty, so a no-op run does not fail on git commit

Media

N/A - CI only.

Requirements

Breaking changes

None.

Backfill plan (post-merge)

After this merges, run:

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

to append the missing entries to CHANGELOG.md in one pass.

the BOT_TOKEN secret no longer authenticates, breaking every
post-merge changelog update since #66. switch to the built-in
GITHUB_TOKEN with contents:write, check out master directly
(github.ref points at refs/pull/N/merge after close), and push
to master explicitly so the run no longer depends on a stale
secret.
Copilot AI review requested due to automatic review settings May 7, 2026 17:24
@github-actions github-actions Bot added S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. C: No Java Changes: Requires no Java knowledge to review or fix this item. and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels May 7, 2026
@duzos duzos added the bug Something isn't working label 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

Fixes the post-merge Update Changelog GitHub Actions workflow so it can authenticate again, check out/push the correct branch, and avoid failing on no-op runs.

Changes:

  • Switches checkout/auth from BOT_TOKEN to the built-in GITHUB_TOKEN and adds job-level contents: write permissions.
  • Ensures the workflow operates on master (ref: master) and pushes explicitly to origin HEAD:master.
  • Skips the commit/push when CHANGELOG.md has no staged changes.

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

Comment thread .github/workflows/append_changelog.yml
setting an explicit permissions block drops every unspecified scope
to none, and scripts/update_changelog.py calls /pulls/{n} and
/pulls/{n}/commits to build the entry, so contents:write alone
would 403.

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 1 comment.

Comment thread .github/workflows/append_changelog.yml
two PRs merging close together would have both runs check out
master, append, and race on the push - second one would lose with
non-fast-forward. queue them with cancel-in-progress:false so each
run sees the prior changelog commit before appending.

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.

@duzos duzos merged commit 980c06c into master May 7, 2026
5 checks passed
@duzos duzos deleted the ci/fix-changelog-token branch May 7, 2026 17:55
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants