Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/auto-rebase-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ on:
default: ''
type: string
secrets:
GH_PAT_DON_PETRY:
description: "Canonical org PAT — preferred over GH_PAT_WORKFLOWS when present"
required: false
GH_PAT_WORKFLOWS:
description: "PAT with workflows scope — required for sentinel comment to trigger dev-lead rebase"
required: false
Expand Down Expand Up @@ -104,8 +107,8 @@ jobs:

- name: Update behind non-Dependabot PRs
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS || github.token }}
HAS_PAT: ${{ secrets.GH_PAT_WORKFLOWS != '' }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS || github.token }}
HAS_PAT: ${{ (secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS) != '' }}
REPO: ${{ github.repository }}
ELIGIBILITY: ${{ inputs.eligibility }}
READY_LABEL: ${{ inputs.ready_label }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/daily-org-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Generate org status report
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
chmod +x scripts/org_status.sh scripts/org_report.sh
bash scripts/org_status.sh > /tmp/report.md
Expand All @@ -47,7 +47,7 @@ jobs:

- name: Create daily-report issue
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
DATE=$(date -u +%Y-%m-%d)
# This digest embeds the date in its title, so a fresh issue is created
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/feature-ideation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ jobs:
# A workflow_dispatch fired with GITHUB_TOKEN is accepted but never starts
# a run (loop prevention), so a PAT is required (same as initiative-planner).
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "::error::GH_PAT_WORKFLOWS is required — a workflow_dispatch fired with GITHUB_TOKEN will not start a run."
echo "::error::GH_PAT_DON_PETRY (or legacy GH_PAT_WORKFLOWS) is required — a workflow_dispatch fired with GITHUB_TOKEN will not start a run."
exit 1
fi
- name: Re-dispatch under workflow_dispatch
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
REPO: ${{ github.repository }}
DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
run: |
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/idea-enhancer-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ on:
default: "petry-projects/.github-private"
type: string
secrets:
GH_PAT_DON_PETRY:
description: "Canonical org PAT — preferred over GH_PAT_WORKFLOWS when present"
required: false
GH_PAT_WORKFLOWS:
description: "Classic PAT with repo + workflow scope used to dispatch the central idea-enhancer (GITHUB_TOKEN cannot start a workflow_dispatch run)."
required: true
Expand All @@ -51,16 +54,16 @@ jobs:
steps:
- name: Guard — PAT present
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "::error::GH_PAT_WORKFLOWS is required — a workflow_dispatch fired with GITHUB_TOKEN will not start a run."
echo "::error::GH_PAT_DON_PETRY (or legacy GH_PAT_WORKFLOWS) is required — a workflow_dispatch fired with GITHUB_TOKEN will not start a run."
exit 1
fi

- name: Dispatch central idea-enhancer for this repo
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
CENTRAL_REPO: ${{ inputs.central_repo }}
TARGET_REPO: ${{ github.repository }}
run: |
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/idea-triage-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ on:
default: "petry-projects/.github-private"
type: string
secrets:
GH_PAT_DON_PETRY:
description: "Canonical org PAT — preferred over GH_PAT_WORKFLOWS when present"
required: false
GH_PAT_WORKFLOWS:
description: "Classic PAT with repo + workflow scope used to dispatch the central idea-triage (GITHUB_TOKEN cannot start a workflow_dispatch run)."
required: true
Expand All @@ -41,16 +44,16 @@ jobs:
steps:
- name: Guard — PAT present
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "::error::GH_PAT_WORKFLOWS is required — a workflow_dispatch fired with GITHUB_TOKEN will not start a run."
echo "::error::GH_PAT_DON_PETRY (or legacy GH_PAT_WORKFLOWS) is required — a workflow_dispatch fired with GITHUB_TOKEN will not start a run."
exit 1
fi

- name: Dispatch central idea-triage for this repo
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
CENTRAL_REPO: ${{ inputs.central_repo }}
TARGET_REPO: ${{ github.repository }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/initiative-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ jobs:
- name: Guard — PAT present
# PAT required: a workflow_dispatch fired with GITHUB_TOKEN never starts a run.
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "::error::GH_PAT_WORKFLOWS is required — a workflow_dispatch fired with GITHUB_TOKEN never starts a run."
echo "::error::GH_PAT_DON_PETRY (or legacy GH_PAT_WORKFLOWS) is required — a workflow_dispatch fired with GITHUB_TOKEN never starts a run."
exit 1
fi

- name: Dispatch central initiative-driver
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
gh workflow run initiative-driver.yml \
-R petry-projects/.github-private \
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/initiative-planner-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ on:
default: "petry-projects/.github-private"
type: string
secrets:
GH_PAT_DON_PETRY:
description: "Canonical org PAT — preferred over GH_PAT_WORKFLOWS when present"
required: false
GH_PAT_WORKFLOWS:
description: "Classic PAT with repo + workflow scope used to dispatch the central initiative-planner (GITHUB_TOKEN cannot start a workflow_dispatch run)."
required: true
Expand All @@ -54,17 +57,17 @@ jobs:
steps:
- name: Guard — PAT present
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "::error::GH_PAT_WORKFLOWS is required — a workflow_dispatch fired with GITHUB_TOKEN will not start a run."
echo "::error::GH_PAT_DON_PETRY (or legacy GH_PAT_WORKFLOWS) is required — a workflow_dispatch fired with GITHUB_TOKEN will not start a run."
exit 1
fi

- name: Guard — trusted actor
id: trust
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
REPO: ${{ github.repository }}
ACTOR: ${{ github.event.sender.login }}
run: |
Expand All @@ -86,7 +89,7 @@ jobs:
- name: Dispatch central planner for this repo
if: steps.trust.outputs.trusted == 'true'
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
PLANNER_REPO: ${{ inputs.planner_repo }}
TARGET_REPO: ${{ github.repository }}
DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/persona-mention-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ on:
default: 'main'
type: string
secrets:
GH_PAT_DON_PETRY:
description: "Canonical org PAT — preferred over GH_PAT_WORKFLOWS when present"
required: false
GH_PAT_WORKFLOWS:
description: 'Classic PAT with repo scope, used for API calls and dispatching the persona'
required: true
Expand Down Expand Up @@ -118,7 +121,7 @@ jobs:

- name: Route the mention
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
PERSONA_REF: ${{ inputs.persona_ref }}
# Every event field arrives via env, never interpolated inline into the
# run: body. A comment body and a login are attacker-controlled, and an
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pinned-version-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
persist-credentials: false
- name: Guard — PAT present
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "::error::GH_PAT_WORKFLOWS is required — cross-repo reads need the org PAT, not github.token."
echo "::error::GH_PAT_DON_PETRY (or legacy GH_PAT_WORKFLOWS) is required — cross-repo reads need the org PAT, not github.token."
exit 1
fi
- name: Generate pinned-version report
env:
# Needs cross-repo read on consumers + tag read on the host repos.
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
ORG: petry-projects
run: bash scripts/pinned-version-report.sh
2 changes: 1 addition & 1 deletion .github/workflows/pr-auto-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
actions: read
uses: ./.github/workflows/pr-auto-review-reusable.yml # local ref — always current
secrets:
GH_PAT_WORKFLOWS: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_PAT_WORKFLOWS: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
9 changes: 6 additions & 3 deletions .github/workflows/pr-review-mention-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ name: PR Review — Mention Trigger (Reusable)
on:
workflow_call:
secrets:
GH_PAT_DON_PETRY:
description: "Canonical org PAT — preferred over GH_PAT_WORKFLOWS when present"
required: false
GH_PAT_WORKFLOWS:
description: "Classic PAT with repo scope used for API calls and dispatching the review agent"
required: true
Expand Down Expand Up @@ -73,7 +76,7 @@ jobs:
- name: Check commenter trust level
id: trust
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
run: |
# Only OWNER, MEMBER, and COLLABORATOR can trigger reviews.
# This prevents external contributors or bots from burning review quota.
Expand Down Expand Up @@ -115,7 +118,7 @@ jobs:
id: pr
if: steps.trust.outputs.trusted == 'true'
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
# Resolve by event name: review_requested and review-comment payloads
# expose the PR directly; only issue_comment needs a gh api round-trip.
# Guard the empty case so we never call `gh api ""` (#500).
Expand Down Expand Up @@ -192,7 +195,7 @@ jobs:
- name: Trigger review agent
if: steps.trust.outputs.trusted == 'true'
env:
GH_TOKEN: ${{ secrets.GH_PAT_WORKFLOWS }}
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
PR_URL: ${{ steps.pr.outputs.pr_url }}
run: |
# repository_dispatch requires only Contents: write, not Actions: write.
Expand Down
2 changes: 1 addition & 1 deletion node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions test/workflows/pr-review-mention/reusable-secrets.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bats
# Pins the credential fallback wiring inside the reusable
# pr-review-mention-reusable.yml (issue #833).
#
# The thin caller invokes this reusable with `secrets: inherit`, so both
# GH_PAT_DON_PETRY (canonical org secret) and GH_PAT_WORKFLOWS (legacy) resolve
# inside its steps. Every GH_TOKEN must prefer the canonical secret with the old
# name as a `||` fallback, so retiring GH_PAT_WORKFLOWS org-wide leaves behavior
# intact (.github-private#1326).

setup() {
load 'helpers/setup'
}

FALLBACK='${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}'

gh_token_for_step() {
local step_name="$1"
yq -r ".jobs.handle-mention.steps[] | select(.name == \"${step_name}\") | .env.GH_TOKEN" "$TT_WORKFLOW"
}

@test "reusable: 'Check commenter trust level' GH_TOKEN uses the canonical fallback" {
run gh_token_for_step "Check commenter trust level"
[ "$status" -eq 0 ]
[ "$output" = "$FALLBACK" ]
}

@test "reusable: 'Resolve PR URL' GH_TOKEN uses the canonical fallback" {
run gh_token_for_step "Resolve PR URL"
[ "$status" -eq 0 ]
[ "$output" = "$FALLBACK" ]
}

@test "reusable: 'Trigger review agent' GH_TOKEN uses the canonical fallback" {
run gh_token_for_step "Trigger review agent"
[ "$status" -eq 0 ]
[ "$output" = "$FALLBACK" ]
}
Loading