Skip to content

Move automated commits/PRs to the quantecon-services machine account (dedicated PAT) #319

Open

Description

@mmcky

Summary

Move our automated cross-repo commits and PRs (translation-sync, content-sync, activity-report posting, and similar scheduled automation) off a personal token and onto the existing quantecon-services machine account, using its own dedicated fine-grained PAT (an org secret).

Why

  • Attribution accuracy. Today these run under a personal token, so they show up as @mmcky. In the May 2026 activity report that's ~18 translation-sync PRs + ~12 content-sync PRs + maintenance PRs all attributed to a person, which makes it hard to separate human work from automation in our reports. A dedicated bot account fixes this at the source.
  • Bus factor / security. Automation shouldn't depend on one maintainer's personal PAT. A machine account gives least-privilege, centrally-rotatable credentials that don't break (or leak personal scope) when an individual's token changes.
  • Downstream CI. PRs opened by the default GITHUB_TOKEN don't trigger pull_request workflows; a dedicated account's PAT does — so bot-opened PRs (e.g. the new monthly activity report PR) actually get CI.

Good news

quantecon-services is already a registered GitHub user (created 2016, display name "QuantEcon"). So this is provisioning + wiring, not account creation.

Proposed steps

  1. Generate a fine-grained PAT on quantecon-services, scoped only to the repos automation writes to, with Contents + Pull requests + Issues = read/write. Set an expiry and a rotation reminder.
  2. Add quantecon-services to a team with write access to the target repos (and branch-protection bypass where automation pushes directly).
  3. Store the PAT as an org-level Actions secret (e.g. QUANTECON_SERVICES_PAT) so repos share one credential.
  4. Migrate the workflows that currently use a personal token to secrets.QUANTECON_SERVICES_PAT:
    • QuantEcon/action-translation consumers (translation-sync into *.fa / *.zh-cn)
    • content-sync workflows (e.g. lecture-dp ← lecture-python-advanced.myst / lecture-python.myst)
    • activity-report posting (QuantEcon/action-activity-report weekly + monthly)
    • any other scheduled automation that pushes/opens PRs
  5. Revoke the personal PAT once everything is migrated and verified.

Alternative to weigh: a GitHub App

A GitHub App (short-lived installation tokens, no PAT expiry, per-repo install, fine scopes) is the sturdier long-term option and avoids PAT rotation entirely. This issue proposes the PAT path as the simplest first step, but flagging the App as the more robust alternative if we'd rather not manage a long-lived token.

Open questions

  • Fine-grained PAT vs GitHub App?
  • Org-level secret vs per-repo secrets?
  • Does adding quantecon-services as an org member consume a paid seat?

Context: surfaced while reviewing the May 2026 monthly activity report (QuantEcon/action-activity-report), where automated PRs dominate and are all attributed to a single maintainer.

Activity

  1. self-assigned this
    on Jun 4, 2026
  2. mmcky commented on Aug 4, 2026

    @mmcky
    ContributorAuthor

    Step 4 is already done, and that changes the shape of what is left. All three live sync workflows in QuantEcon/lecture-python-programming — sync-translations-{fa,fr,zh-cn}.yml — already authenticate with secrets.QUANTECON_SERVICES_PAT, the exact secret name this issue's step 3 proposes. The wiring landed at some point without the rest of the plan.

    But every translation-sync-* pull request in the fleet is still authored by @mmcky, including three opened on 2026-08-04. So the secret exists and is in use, and it holds a personal PAT rather than a quantecon-services one. (Inferred from PR authorship — reading the org secret needs admin:org, which I do not have. The inference is tight: a services PAT in that secret would produce services-authored PRs.)

    What that means practically: this is not a 5-step migration any more. Steps 3 and 4 are effectively complete, and what remains is mint the fine-grained PAT, grant write access, swap the secret's value, verify, revoke. No workflow edits at all.

    The blocker for step 2, measured

    quantecon-services currently holds permission read on every translation target — lecture-python-programming.{zh-cn,fa,fr,ml}, lecture-python.zh-cn, lecture-intro.zh-cn — and on all three test-translation-sync.* harness repos. Only lecture-python-programming itself grants it admin. So a services PAT minted today could not create a branch or open a pull request anywhere the automation writes. The account has also authored 0 pull requests anywhere on GitHub, ever.

    Step 2 is therefore the gate on the whole migration, not step 1, and it is worth reordering to say so.

    A benefit not costed here

    This issue motivates the move on attribution, bus factor and downstream CI. There is a fourth: it removes GitHub Copilot's automatic code review from every automated PR.

    That review follows the PR author's personal account setting, which is account-wide with no repo filter. Measured across 770 Copilot-reviewed PRs in the translation estate, 685 are @mmcky self-requested within 120 seconds of creation, and no other account has ever triggered an automatic one. The estate has accumulated 774 Copilot review comments, and on the one edition read line by line — the five Malayalam calibration PRs — none of the 29 comments was a translation defect, while a majority argued against that edition's deliberate keep-English policy. Detail in QuantEcon/project-translation#21.

    Two caveats so this is not over-claimed. The migration covers the automated class only — roughly 30% of comment volume in the production editions; CLI resync PRs shell out through spawnSync('gh', ...) and inherit the operator's local login, so no secret swap reaches them. And the outcome depends on quantecon-services's own Copilot setting, which is unobservable from outside given the account has no PR history.

    Three consequences worth carrying into the plan

    Notification routing collapses to nobody. pr-reviewers and pr-team-reviewers are unset in all five live sync workflows and no target repo has a CODEOWNERS file, so the only thing currently routing sync PRs to a human is @mmcky's author-subscription. After the swap every sync PR is unwatched by construction. Set pr-reviewers before the secret swap, not after.

    The first-time-contributor gate becomes live. With zero prior PRs and read permission, the account's first PRs would park target-side pull_request workflows at action_required — including review-translations.yml, which fails silently, and ci.yml, the preview job whose absence cost the French editor about 30 hours of unpreviewed work. Grant write and burn the first-time flag with one throwaway PR before cutover, and have the verification step confirm the review workflow actually ran rather than merely that it was configured.

    One open question here has an answer now. On "does adding quantecon-services as an org member consume a paid seat" — the org's Copilot billing currently reads total seats: 0 with seat_management_setting: unconfigured, so no Copilot seat is in play today. That does not settle the general org-membership seat question, but it removes one variable.

    Also relevant to the PAT-vs-App question: QuantEcon/action-translation#221 records that GitHub Apps always report author_association=NONE, which would silently break the \translate-resync trust gate that QuantEcon/action-translation#192 added — a machine user needs no change, an App does. That is an argument for the PAT path this issue already proposes.

  3. mmcky commented on Aug 7, 2026

    @mmcky
    ContributorAuthor

    This rollout is incomplete in a way that is failing silently right now, in at least three repos. Found while independently validating QuantEcon/data-lectures#51.

    QUANTECON_SERVICES_PAT exists as an org secret and works where it has been granted. But its selected-repository list does not include lecture-intro.zh-cn, lecture-python-programming.zh-cn or lecture-python-programming.fa. In those repos the secret resolves empty, so rebase-translations.yml dies in 2-5 seconds with Action failed: Input required and not supplied: github-token (getRebaseInputs, inputs.ts:137).

    Evidence — lecture-intro.zh-cn

    The workflow has been dead since 727c91bd (2026-07-21, #273) switched line 61 to github-token: ${{ secrets.QUANTECON_SERVICES_PAT }}. Every translation-sync merge since has failed:

    Run Date Outcome
    29632704236 (pr-793) 2026-07-18 success — predates the PAT change
    29720103931 (pr-798) 2026-07-20 success — predates the PAT change
    30068497165 2026-07-24 failure
    31139470551 2026-08-07 failure
    31139697605 2026-08-07 failure
    31145835302 2026-08-07 failure

    All four failures postdate the commit; both successes predate it. Confirmed against the org-secrets listing: lecture-intro.zh-cn carries ANTHROPIC_API_KEY and NETLIFY_AUTH_TOKEN only, while lecture-python.zh-cn additionally has QUANTECON_SERVICES_PAT — and its rebase succeeded on 2026-08-07, same day, same workflow. That contrast is what isolates it to the grant rather than the workflow.

    Why it matters beyond a red X

    The consequence is mechanically visible today: six open sync PRs sit four commits behind main, unrebased since 2026-08-03 despite three merges landing on 2026-08-07 (compare/main...translation-sync-…pr-819 → behind_by=4).

    main has no branch protection in that repo (branches/main/protection → 404, "Branch not protected"), so nothing forces a PR up to date before merge. A queued sync PR can therefore merge content generated against a stale base — which is a quiet correctness risk on top of the visible failures, and it lands in the same repo where QuantEcon/workspace-lectures#25 already showed a sync overwriting a deliberate localisation.

    The failure mode is the worst kind for a rollout: the workflow runs, goes red for three seconds, and nothing downstream notices. Two repos migrated cleanly and three did not, and the difference is invisible unless you compare secrets listings.

    Fix

    A repo-access grant on the existing org secret for the three repos — no code change. Worth also confirming the full selected-repository list against every repo that references QUANTECON_SERVICES_PAT in a workflow, since the same gap will exist anywhere else the rollout touched but the grant missed.

  4. mmcky commented on Aug 10, 2026

    @mmcky
    ContributorAuthor

    Adding a fourth repo to the grant list — lecture-python-programming.fr fails the same way and is not named above.

    Run 30588869951 (2026-07-30, Rebase Translation PRs) ends with ##[error]Error: Input required and not supplied: github-token, byte-identical to the intro.zh-cn / programming.zh-cn / fa signature. Its last success was 2026-07-18, before the PAT switch.

    Full live picture as of 2026-08-10, one row per edition, taking the most recent non-skipped run in each (skipped runs mean the trigger condition was not met, not that the workflow is healthy — which is why fr reads clean at a glance):

    Edition Last non-skipped run Conclusion
    lecture-python.zh-cn 2026-08-07 ✅ success — the only one working
    lecture-intro.zh-cn 2026-08-07 (×2) 🔴 failure — github-token
    lecture-python-programming.zh-cn 2026-07-30 🔴 failure — github-token
    lecture-python-programming.fa 2026-07-30 🔴 failure — github-token
    lecture-python-programming.fr 2026-07-30 🔴 failure — github-token

    So the grant needs four repositories added, not three.

    Two operational consequences worth recording while this is open, because they invert an assumption the translation programme has been working from. The standing rule has been "the rebase automation overwrites your hand fixes after any merge to main" — that is true on lecture-python.zh-cn only. On the other four the automation is dead, so hand fixes are safe from clobber but branches silently go stale: gh pr update-branch has to be run by hand before a green check can be trusted. lecture-intro.zh-cn's six open sync PRs have been drifting behind main for that reason.

    Recorded on the programme side in project-translation#27 and in the 2026-08-10 register refresh.

  5. mmcky commented on Aug 18, 2026

    @mmcky
    ContributorAuthor

    Grant extended 2026-08-18 (@mmcky) — the fine-grained PAT repo access now covers the remaining repos. Field verification is scheduled rather than assumed: the next translation-program session (QuantEcon/project-translation#36, item 1) triages the fa/fr backlogs and will observe whether rebase automation comes alive on programming.zh-cn / programming.fa / programming.fr — the three repos with no confirmed non-skipped run. Until that confirms, gh pr update-branch by hand remains the safe path there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions