fix: move changelog generation to push-to-main event#177
Merged
elantiguamsft merged 1 commit intomainfrom Mar 17, 2026
Merged
Conversation
Fork PRs cannot push back to the source branch because GITHUB_TOKEN lacks write access to fork repositories. This moves changelog generation from the pull_request event to the push event so it runs after merge to main, before create_release. Key changes: - create_changelog now generates and commits on push-to-main instead of during pull_request (resolves fork PR failures). - create_release now depends on create_changelog so the release always includes the latest changelog. - Removed needs: [build] from create_changelog (build only runs on PRs; changelog generation is independent). - Upgraded actions/checkout from v2 to v4. - Trimmed permissions to only contents: write. - GITHUB_TOKEN commits do not trigger new workflow runs, preventing infinite loops. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
elantiguamsft
approved these changes
Mar 16, 2026
NN2000X
approved these changes
Mar 16, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #176
Problem
The
create_changelogjob fails for fork PRs because it runsgit checkout $GITHUB_HEAD_REF, which references a branch that only exists in the fork — not in the upstream repo. Additionally,GITHUB_TOKENonpull_requestevents cannot push to fork branches (GitHub security boundary).Solution
Move changelog generation from the
pull_requestevent to thepushevent so it runs after merge to main, beforecreate_release.Key changes
create_changelognow generates and commits CHANGELOG.md on push-to-main instead of during pull requests. On PRs it passes without committing.create_releasenow hasneeds: [create_changelog]so the release always includes the freshly generated changelog.needs: [build]fromcreate_changelog(build only runs on PRs; changelog generation is independent).actions/checkoutfrom v2 to v4.contents: write.Why this is safe
Commits made with
GITHUB_TOKENdo not trigger new workflow runs — this is a GitHub built-in safeguard, so there is no risk of infinite loops.