ci: fix release push to protected main (bypass token)#17
Merged
Conversation
The default GITHUB_TOKEN cannot push the @semantic-release/git version commit to the protected main branch (GH006, requires PR). Delegate to Innoactive/Portal-Backend's reusable semantic-release workflow, authenticated with a repo-scoped SEMANTIC_RELEASE_GH_TOKEN whose identity bypasses PR protection on main. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A public repo cannot call the private Portal-Backend reusable workflow, so run semantic-release directly here instead. persist-credentials:false ensures the push to the protected main branch uses SEMANTIC_RELEASE_GH_TOKEN (whose identity is on main's bypass list) rather than the default GITHUB_TOKEN. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The Release pipeline fails on the Semantic Release step (example run):
.releaserc.jsonuses@semantic-release/git, which commits the version bump topyproject.tomland pushes it tomain. Butmainis protected (requires a PR,enforce_adminson), and the defaultGITHUB_TOKEN/github-actions[bot]is not on the bypass list — so the push is declined and no release is published.Fix
Run semantic-release with a repo-scoped
SEMANTIC_RELEASE_GH_TOKENwhose identity bypasses PR protection onmain.Notes on the approach:
semantic-release.ymllives in the privatePortal-Backendrepo. GitHub does not allow a public repo to call a private repo's reusable workflow, so the release job is defined directly here instead.persist-credentials: falseon checkout is required: otherwiseactions/checkoutstores the defaultGITHUB_TOKENas a git auth header and the push would use that (-> GH006 again) instead of the bypass token.scripts/update-version-number.sh) is puresedand there is no publish step.Prerequisites (GitHub settings)
SEMANTIC_RELEASE_GH_TOKENsecret createdmain's branch-protection PR-bypass list (currently onlyburnedikt)Contents: writeTesting
The release workflow only triggers on
pushtomain, so this is validated by the next merge tomainproducing a release.🤖 Generated with Claude Code