Skip to content

fix: pass github-token to primary checkout in stable-sync action - #276

Merged
tommasini merged 1 commit into
mainfrom
fix/stable-sync-checkout-token
Aug 11, 2026
Merged

fix: pass github-token to primary checkout in stable-sync action#276
tommasini merged 1 commit into
mainfrom
fix/stable-sync-checkout-token

Conversation

@tommasini

Copy link
Copy Markdown
Contributor

Summary

stable-sync's first actions/checkout step (checking out the consuming repo, e.g. metamask-mobile) never forwards the action's own github-token input. It relies on actions/checkout's default (github.token), which is only as privileged as the calling job's permissions: block.

metamask-mobile's stable-branch-sync.yml migrated to OIDC token exchange (#32331 there), and its run-stable-sync job now scopes its own permissions: down to just id-token: write. Job-level permissions: replaces (not merges with) the workflow-level block, so the default GITHUB_TOKEN for that job has no contents: write — it's read-only (Metadata: read).

Meanwhile the elevated, narrowly-scoped token obtained via OIDC exchange is passed into this action as github-token, but is only wired into the final gh pr create step. The checkout step (whose persisted git credentials are what git push at the end of this action actually uses) never sees it.

Net effect: the branch push at the end of run-stable-sync fails every time with:

remote: Permission to <repo>.git denied to github-actions[bot].
fatal: unable to access '...': The requested URL returned error: 403

Since that step fails, the following Create Pull Request step is skipped, so no stable -> main sync PR is ever opened. This has been silently broken for metamask-mobile since ~2026-07-13 (once the OIDC-migrated workflow reached its stable branch) — see runs 29279657644, 29439944223, 29787290543, 30291849225, 30655332762, 31421433607.

Fix

Pass token: ${{ inputs.github-token }} on the primary checkout, matching the sibling release-branch-sync action, which already does this correctly and has never had this issue:

- name: Checkout repositoryuses: actions/checkout@v6with:
fetch-depth: 0token: ${{ inputs.github-token }}

Follow-up (in metamask-mobile, not part of this PR)

Once a new tag is cut with this fix, metamask-mobile's .github/workflows/stable-branch-sync.yml needs its stable-sync@v1.16.0 pin bumped to pick it up, and a stable push (or manual re-run) will be needed to generate the missing stable-main-X.Y.Z -> main sync PR(s).

Test plan

  • Cut a new tag including this change
  • Bump the pin in a consuming workflow (e.g. metamask-mobile's stable-branch-sync.yml) and re-run/push to confirm the checkout now persists the elevated token and the branch push + PR creation succeed

Made with Cursor

The main repo checkout step didn't forward the elevated github-token
input to actions/checkout, so it silently fell back to the caller's
default GITHUB_TOKEN for persisted git credentials. When a consuming
workflow scopes its job-level permissions down to just id-token: write
(as metamask-mobile's stable-branch-sync.yml does after migrating to
OIDC token exchange), that default token has no contents:write, and
the branch push later in this action fails with a 403:
remote: Permission to MetaMask/metamask-mobile.git denied to github-actions[bot].
fatal: unable to access '...': The requested URL returned error: 403
Since the push fails, the subsequent "Create Pull Request" step is
skipped, so no stable -> main sync PR ever gets opened.
This mirrors the sibling release-branch-sync action, which already
passes token: ${{ inputs.github-token }} on its primary checkout.
Co-authored-by: Cursor <cursoragent@cursor.com>

@Cal-LCal-L left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tommasini
tommasini merged commit 3f30490 into mainAug 11, 2026
10 checks passed
@tommasini
tommasini deleted the fix/stable-sync-checkout-token branch August 11, 2026 11:25
Sign up for freeto 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.

2 participants

@tommasini@Cal-L