Skip to content

fix: move changelog generation to push-to-main event#177

Merged
elantiguamsft merged 1 commit intomainfrom
fix/changelog-fork-prs
Mar 17, 2026
Merged

fix: move changelog generation to push-to-main event#177
elantiguamsft merged 1 commit intomainfrom
fix/changelog-fork-prs

Conversation

@JeromySt
Copy link
Copy Markdown
Member

Resolves #176

Problem

The create_changelog job fails for fork PRs because it runs git checkout $GITHUB_HEAD_REF, which references a branch that only exists in the fork — not in the upstream repo. Additionally, GITHUB_TOKEN on pull_request events cannot push to fork branches (GitHub security boundary).

Solution

Move 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 CHANGELOG.md on push-to-main instead of during pull requests. On PRs it passes without committing.
  • create_release now has needs: [create_changelog] so the release always includes the freshly generated 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.

Why this is safe

Commits made with GITHUB_TOKEN do not trigger new workflow runs — this is a GitHub built-in safeguard, so there is no risk of infinite loops.

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 elantiguamsft merged commit 5fe1f5a into main Mar 17, 2026
12 checks passed
@elantiguamsft elantiguamsft deleted the fix/changelog-fork-prs branch March 17, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update CoseSignTool CI to support githubs fork/merge strategy for open source.

4 participants