Skip to content

ci: fix release push to protected main (bypass token)#17

Merged
burnedikt merged 2 commits into
mainfrom
ci/upgrade-actions-node24
Jul 23, 2026
Merged

ci: fix release push to protected main (bypass token)#17
burnedikt merged 2 commits into
mainfrom
ci/upgrade-actions-node24

Conversation

@burnedikt

@burnedikt burnedikt commented Jul 23, 2026

Copy link
Copy Markdown
Member

Problem

The Release pipeline fails on the Semantic Release step (example run):

git push --tags https://github.com/Innoactive/Portal-Python-CLI HEAD:main
remote: error: GH006: Protected branch update failed for refs/heads/main.
- Changes must be made through a pull request.

.releaserc.json uses @semantic-release/git, which commits the version bump to pyproject.toml and pushes it to main. But main is protected (requires a PR, enforce_admins on), and the default GITHUB_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_TOKEN whose identity bypasses PR protection on main.

Notes on the approach:

  • Inline, not the shared org workflow. This repo is public and the org's reusable semantic-release.yml lives in the private Portal-Backend repo. 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: false on checkout is required: otherwise actions/checkout stores the default GITHUB_TOKEN as a git auth header and the push would use that (-> GH006 again) instead of the bypass token.
  • Repo-scoped token was chosen over sharing the broad org-wide token with this public repo, to keep the credential's blast radius limited to this repo (a repo secret overrides the org secret of the same name).
  • Dropped the inline Python/uv setup — the version bump (scripts/update-version-number.sh) is pure sed and there is no publish step.

Prerequisites (GitHub settings)

  • Repo-scoped SEMANTIC_RELEASE_GH_TOKEN secret created
  • Token identity added to main's branch-protection PR-bypass list (currently only burnedikt)
  • Token has Contents: write

Testing

The release workflow only triggers on push to main, so this is validated by the next merge to main producing a release.

🤖 Generated with Claude Code

burnedikt and others added 2 commits July 23, 2026 11:48
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>
@burnedikt burnedikt changed the title ci: fix release push to protected main via shared semantic-release workflow ci: fix release push to protected main (bypass token) Jul 23, 2026
@burnedikt
burnedikt merged commit 58de3a2 into main Jul 23, 2026
2 checks passed
@burnedikt
burnedikt deleted the ci/upgrade-actions-node24 branch July 23, 2026 10:01
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.

1 participant