Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions .github/workflows/auto-rebase-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,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
4 changes: 2 additions & 2 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."
Comment thread
Copilot marked this conversation as resolved.
Outdated
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
4 changes: 2 additions & 2 deletions .github/workflows/idea-enhancer-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ 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."
Comment thread
Copilot marked this conversation as resolved.
Outdated
Expand All @@ -60,7 +60,7 @@ jobs:

- 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
4 changes: 2 additions & 2 deletions .github/workflows/idea-triage-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ 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."
Comment thread
Copilot marked this conversation as resolved.
Outdated
Expand All @@ -50,7 +50,7 @@ jobs:

- 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
4 changes: 2 additions & 2 deletions .github/workflows/initiative-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ 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."
Comment thread
Copilot marked this conversation as resolved.
Outdated
Expand All @@ -82,7 +82,7 @@ jobs:

- 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
6 changes: 3 additions & 3 deletions .github/workflows/initiative-planner-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ 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."
Comment thread
Copilot marked this conversation as resolved.
Outdated
Expand All @@ -64,7 +64,7 @@ jobs:
- 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 +86,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
2 changes: 1 addition & 1 deletion .github/workflows/persona-mention-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,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
4 changes: 2 additions & 2 deletions .github/workflows/pinned-version-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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."
Comment thread
Copilot marked this conversation as resolved.
Outdated
Expand All @@ -30,6 +30,6 @@ jobs:
- 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 }}
6 changes: 3 additions & 3 deletions .github/workflows/pr-review-mention-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,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 +115,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 +192,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
36 changes: 36 additions & 0 deletions test/workflows/pr-review-mention/reusable-secrets.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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).

load 'helpers/setup'
Comment thread
don-petry marked this conversation as resolved.
Outdated

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