Skip to content

Migrate bare GH_PAT_WORKFLOWS refs to GH_PAT_DON_PETRY fallback (unblock secret retirement) #833

Closed

Description

@don-petry

Goal

Migrate every bare secrets.GH_PAT_WORKFLOWS reference in this repo's workflows to the canonical-first fallback chain ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}. This is the last blocker to deleting the legacy org secret GH_PAT_WORKFLOWS (tracked in .github-private#1326).

GH_PAT_DON_PETRY is an org secret available to all repos and holds the same don-petry PAT. Adding it as the first term makes every consumer prefer it; the || secrets.GH_PAT_WORKFLOWS term keeps behavior identical until the old secret is deleted. Referencing secrets.GH_PAT_DON_PETRY inside a || expression needs no workflow_call.secrets declaration (an unset secret in a || just evaluates empty) — so no secrets: blocks change except where noted below.

Scope — files & lines (origin/main)

Replace each bare secrets.GH_PAT_WORKFLOWS with secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS:

  • auto-rebase-reusable.yml — L107 (GH_TOKEN). L108 footgun below.
  • daily-org-status.yml — L25, L50
  • feature-ideation.yml — L110, L118
  • idea-enhancer-reusable.yml — L54, L63
  • idea-triage-reusable.yml — L44, L53
  • initiative-driver.yml — L76, L85
  • initiative-planner-reusable.yml — L57, L67, L89
  • persona-mention-reusable.yml — L121
  • pinned-version-report.yml — L24, L33
  • pr-review-mention-reusable.yml — L76, L118, L195
  • pr-auto-review.yml — L52. by-name footgun below.
  • pr-auto-review-reusable.yml — L45, L118, L126, L231. See footgun — these are consumed via the by-name pass, so leave them unchanged.

Two footguns — do NOT naive-find/replace these

  1. auto-rebase-reusable.yml:108 is a boolean guard HAS_PAT: ${{ secrets.GH_PAT_WORKFLOWS != '' }}. It must become:

    HAS_PAT: ${{ (secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS) != '' }}

    (parens required, else the guard reads false once the old secret is deleted).

  2. pr-auto-review.yml:52 passes the secret by name into the local pr-auto-review-reusable.yml (secrets: block, not inherit):

    secrets:
      GH_PAT_WORKFLOWS: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}

    Change only this value line. Keep the passed secret name GH_PAT_WORKFLOWS. The four internal refs in pr-auto-review-reusable.yml (L45/118/126/231) already resolve to this passed value — leave them as secrets.GH_PAT_WORKFLOWS, do not add the fallback there (inside a by-name reusable secrets.GH_PAT_DON_PETRY is empty).

Out of scope (no change needed)

  • tests/test_feature_ideation.bats:87 greps secrets.GH_PAT_WORKFLOWS — still a substring of the fallback chain, so it stays green; do not edit.

Acceptance criteria

  • Every bare runtime secrets.GH_PAT_WORKFLOWS above prefers GH_PAT_DON_PETRY, with the two footguns handled as specified.
  • No new workflow_call.secrets declarations added; pr-auto-review.yml keeps passing the name GH_PAT_WORKFLOWS.
  • All workflows still parse (CI green); test_feature_ideation.bats still passes.
  • PR body confirms the auto-rebase != '' guard uses parens.

Once merged with a green run, .github-private#1326 can proceed to delete GH_PAT_WORKFLOWS.

Activity

  1. don-petry commented on Jul 20, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead Implementation Plan

    Issue: #833 — Migrate bare GH_PAT_WORKFLOWS refs to GH_PAT_DON_PETRY fallback (unblock secret retirement)

    Scope

    Replace every bare runtime secrets.GH_PAT_WORKFLOWS in the listed workflows with the canonical-first chain secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS, handling the two footguns exactly, and leaving the by-name-consumed pr-auto-review-reusable.yml internal refs bare.

    Implementation Checklist

    • auto-rebase-reusable.yml L107 → ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS || github.token }}
    • auto-rebase-reusable.yml L108 (footgun) → HAS_PAT: ${{ (secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS) != '' }} (parens required)
    • daily-org-status.yml L25, L50
    • feature-ideation.yml L110, L118
    • idea-enhancer-reusable.yml L54, L63
    • idea-triage-reusable.yml L44, L53
    • initiative-driver.yml L76, L85
    • initiative-planner-reusable.yml L57, L67, L89
    • persona-mention-reusable.yml L121
    • pinned-version-report.yml L24, L33
    • pr-review-mention-reusable.yml L76, L118, L195 (consumed via secrets: inherit, so fallback resolves)
    • pr-auto-review.yml L52 (footgun) → change only the passed value; keep the passed secret name GH_PAT_WORKFLOWS
    • pr-auto-review-reusable.yml L45/118/126/231 → leave bare (by-name pass; GH_PAT_DON_PETRY is empty inside)

    Tests to Write

    • New bats assertions in test/workflows/pr-review-mention/ pinning the reusable's three GH_TOKEN refs to the fallback chain (CI-wired via pr-review-mention-tests.yml). Remaining files are behavior-preserving config with no dedicated harness — covered by YAML-parse + existing suites.

    Test Command

    bats --print-output-on-failure test/workflows/pr-review-mention/ and bash .dev-lead/scripts/dev-lead-lint.sh

  2. don-petry commented on Jul 20, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead: Implementation Complete

    Plan Execution

    • Added a bats regression test (test/workflows/pr-review-mention/reusable-secrets.bats) pinning the three reusable GH_TOKEN refs to the canonical fallback — confirmed red before the migration, green after.
    • Migrated every bare runtime secrets.GH_PAT_WORKFLOWS → secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS across the 11 in-scope files (22 lines, exactly matching the issue scope).
    • Footgun 1 — auto-rebase-reusable.yml:108 guard now uses parens: HAS_PAT: ${{ (secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS) != '' }}; L107 chains GH_PAT_DON_PETRY || GH_PAT_WORKFLOWS || github.token.
    • Footgun 2 — pr-auto-review.yml:52 changed only the value; the passed secret name stays GH_PAT_WORKFLOWS. The four internal refs in pr-auto-review-reusable.yml (L45/118/126/231) left bare (by-name pass; GH_PAT_DON_PETRY is empty inside).
    • No workflow_call.secrets declarations or secrets: block keys added/changed.
    • Verified all 11 workflows parse (yq), dev-lead-lint.sh passes, and affected bats suites are green.

    Test Results

    # bats test/workflows/pr-review-mention/  (includes 3 new tests)
    ok 14 reusable: 'Check commenter trust level' GH_TOKEN uses the canonical fallback
    ok 15 reusable: 'Resolve PR URL' GH_TOKEN uses the canonical fallback
    ok 16 reusable: 'Trigger review agent' GH_TOKEN uses the canonical fallback
    ok 17 stub: GH_PAT_WORKFLOWS input uses the GH_PAT_DON_PETRY || GH_PAT_WORKFLOWS fallback
    ...
    20 tests, 0 failures
    
    # regression suites
    feature-ideation: 126 tests, 0 failures
    auto-rebase:       22 tests, 0 failures
    pr-auto-review:    37 tests, 0 failures
    
    # dev-lead-lint.sh
    [lint] shellcheck on 27 file(s)... OK
    [lint] validating .github/CODEOWNERS... OK
    [lint] all checks passed
    

    Files Changed

    • auto-rebase-reusable.yml: L107 fallback chain; L108 parenthesized != '' guard.
    • daily-org-status.yml, feature-ideation.yml, idea-enhancer-reusable.yml, idea-triage-reusable.yml, initiative-driver.yml, initiative-planner-reusable.yml, persona-mention-reusable.yml, pinned-version-report.yml, pr-review-mention-reusable.yml: bare GH_TOKEN refs → canonical-first fallback.
    • pr-auto-review.yml: passed-value line only; name kept as GH_PAT_WORKFLOWS.
    • test/workflows/pr-review-mention/reusable-secrets.bats: new — pins the reusable's fallback wiring (CI-wired via pr-review-mention-tests.yml).

    Notes

    • pr-auto-review-reusable.yml intentionally unchanged — its refs resolve to the by-name-passed value, where GH_PAT_DON_PETRY is empty. Confirmed the only remaining bare runtime refs in the repo are exactly those four.
    • The issue's out-of-scope note referenced tests/test_feature_ideation.bats:87; no such file exists on this branch, so nothing to leave alone there. The current feature-ideation bats suite stays green.
    • Migration is behavior-preserving until GH_PAT_WORKFLOWS is deleted (unblocks .github-private#1326); the guard-parens ensure the boolean stays correct post-deletion.
  3. added a commit that references this issue on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dev-leadFor dev-lead agent pickup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions