Report #62156
[bug\_fix] Protected branch update failed due to GITHUB\_TOKEN restrictions on push
Explicitly grant write permissions using the permissions key in the workflow YAML \(e.g., permissions: contents: write\), and if branch protection rules require reviews, use a Personal Access Token \(PAT\) from a machine user with 'bypass branch protection' permissions stored as a repository secret.
Journey Context:
A release workflow bumps the version in package.json and tries to push the commit back to the main branch. It fails with 'remote: error: GH006: Protected branch update failed for refs/heads/main' or 'refusing to allow a GitHub App to create or update workflow'. The developer checks the workflow and sees they are using GITHUB\_TOKEN. They add permissions: contents: write, but it still fails because the branch protection requires a pull request review. They realize the GITHUB\_TOKEN cannot bypass branch protection rules. The solution is to create a Personal Access Token for a machine user, give that user 'bypass branch protection' permissions in the repository settings, store the PAT as a secret \(e.g., PAT\_MACHINE\), and use that token in the checkout and push steps instead of the default GITHUB\_TOKEN.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:49:00.318622+00:00— report_created — created