Skip to content

Commit ada5ab5

Browse files
mmckyclaude
andauthored
Rebase pushes with the machine-user PAT (action-translation#125) (#187)
* Rebase pushes with the machine-user PAT (action-translation#125) 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> * Rebase: require a same-repo head branch (fork noise guard) Fork PRs never receive secrets, so the PAT is not exposed — but a merged fork PR whose branch matched a translation prefix would start the job with an empty token and fail red. Skip it instead. Mirrors action-translation#130. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c5c2ce1 commit ada5ab5

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/rebase-translations.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ jobs:
2525
# Keep this in step with `isTranslationBranch` in the action's src/branch-naming.ts
2626
# — this `if` decides whether the job runs, that predicate decides which open PRs
2727
# it then rebases, so a prefix matching only one of them is a no-op run.
28+
# The head-repo check is belt-and-braces: fork PRs never receive secrets, so
29+
# the PAT is not exposed either way — but a merged fork PR whose branch happens
30+
# to match a prefix would otherwise start this job with an empty token and fail
31+
# red. Same-repo branches matching these prefixes only come from the tooling.
2832
if: >
2933
github.event.pull_request.merged == true &&
34+
github.event.pull_request.head.repo.full_name == github.repository &&
3035
(startsWith(github.event.pull_request.head.ref, 'translation-sync-') ||
3136
startsWith(github.event.pull_request.head.ref, 'resync/'))
3237
runs-on: ubuntu-latest
@@ -46,4 +51,11 @@ jobs:
4651
with:
4752
mode: rebase
4853
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
49-
github-token: ${{ secrets.GITHUB_TOKEN }}
54+
# PAT rather than the default GITHUB_TOKEN, deliberately: commits pushed
55+
# with GITHUB_TOKEN trigger no workflows (GitHub's recursion guard), so a
56+
# rebased branch ends up with a run-less head — force-pushed re-translated
57+
# content lands unreviewed, and with required checks a run-less head blocks
58+
# merging. Validated both ways on the test harness, 2026-07-21: zero runs
59+
# under GITHUB_TOKEN, review triggered under the PAT.
60+
# See QuantEcon/action-translation#125.
61+
github-token: ${{ secrets.QUANTECON_SERVICES_PAT }}

0 commit comments

Comments
 (0)