Skip to content

Rebase pushes with the machine-user PAT (action-translation#125)#17

Merged
mmcky merged 1 commit into
mainfrom
rebase-token-pat
Jul 21, 2026
Merged

Rebase pushes with the machine-user PAT (action-translation#125)#17
mmcky merged 1 commit into
mainfrom
rebase-token-pat

Conversation

@mmcky

@mmcky mmcky commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Completes the production half of action-translation#125: the rebase workflow now pushes with the machine-user PAT instead of the default GITHUB_TOKEN.

Why

Commits pushed with GITHUB_TOKEN do not trigger workflows — GitHub's recursion guard — so a rebased branch ends up with a run-less head: force-pushed re-translated content lands unreviewed, and with required status checks a run-less head blocks merging. Measured both ways on the test harness, same repo, same day: 13 GITHUB_TOKEN-rebased heads with zero workflow runs, versus a PAT-refreshed head whose review workflow triggered normally.

This is the same reasoning sync mode has always applied — its PRs trigger the review workflow because it passes the PAT. Rebase pushing to the same PRs with a weaker token was an inconsistency, not a decision.

Safety

  • No loop risk: rebase triggers on closed; the runs a PAT push triggers (CI, review) never push back.
  • Fork exposure: none, including on public repos — secrets are withheld from pull_request workflows triggered from forks regardless of repo visibility, and the job's if only matches branch prefixes the tooling creates.
  • The org-secret grant for this repo is in place (a missing grant fails loudly: Input required and not supplied: github-token).

The harness (test-translation-sync.zh-cn) has carried this exact configuration in steady state since validation.

🤖 Generated with Claude Code

Commits pushed with the default GITHUB_TOKEN trigger no workflows, so a
rebased branch gets a run-less head: force-pushed re-translated content
lands unreviewed, and with required checks a run-less head blocks
merging. Measured both ways on the test harness 2026-07-21 — zero runs
under GITHUB_TOKEN, review triggered under the PAT.

Sync mode has always passed the PAT for exactly this reason; rebase
pushing to the same PRs with a weaker token was an inconsistency, not a
decision.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 21, 2026 06:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the translation rebase workflow to push rebased commits using a machine-user PAT instead of GITHUB_TOKEN, ensuring the resulting force-pushed heads trigger downstream workflows (and therefore required status checks).

Changes:

  • Switch the github-token input for QuantEcon/action-translation@v0 from secrets.GITHUB_TOKEN to secrets.QUANTECON_SERVICES_PAT.
  • Add inline documentation explaining why the PAT is required (workflow recursion guard behavior with GITHUB_TOKEN).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 48 to +52
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
github-token: ${{ secrets.GITHUB_TOKEN }}
# PAT rather than the default GITHUB_TOKEN, deliberately: commits pushed
# with GITHUB_TOKEN trigger no workflows (GitHub's recursion guard), so a
# rebased branch ends up with a run-less head — force-pushed re-translated
# content lands unreviewed, and with required checks a run-less head blocks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted, with one correction to the framing: the PAT was never exposed to fork PRs — GitHub withholds secrets from pull_request workflows triggered from forks regardless of repo visibility, so the security half of this doesn't apply. What IS right is the noise half: a merged fork PR whose branch happened to match a translation prefix would start this job with an empty token and fail red on a merged PR. The head-repo check skips it instead — belt-and-braces plus noise elimination, worth having on a PAT-bearing workflow.

Because this file mirrors the upstream template, the fix went everywhere at once rather than only here: the template (action-translation#130), both harness targets, the still-open python.zh-cn#187 (amended), and follow-up PRs on the four already-merged copies (this repo's is #18).

@github-actions

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-17--verdant-toffee-3261a8.netlify.app

Commit: 8cf99dc


Build Info

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.

2 participants