-
Notifications
You must be signed in to change notification settings - Fork 1
feat: implement issue #791 — Propagate GH_PAT_DON_PETRY credential rename into standards/workflows/pr-review-mention.yml (unblocks fleet template-drift) #792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/usr/bin/env bats | ||
| # Tests for the credential wiring of the canonical caller stub | ||
| # standards/workflows/pr-review-mention.yml (issue #791). | ||
| # | ||
| # The persona-identity rename (#1316 / .github-private#1317) renamed the | ||
| # workflows PAT org secret GH_PAT_WORKFLOWS -> GH_PAT_DON_PETRY, keeping the old | ||
| # name as a `||` transition fallback. The stub must source the reusable's | ||
| # GH_PAT_WORKFLOWS input from that fallback expression. | ||
| # | ||
| # Fail-closed contract: the reusable declares BOTH GH_PAT_WORKFLOWS and | ||
| # DON_PETRY_BOT_GH_PAT as `required: true`. An explicit `secrets:` block passes | ||
| # only the keys it lists (no implicit inherit), so the stub MUST still carry | ||
| # DON_PETRY_BOT_GH_PAT or the acknowledgement step loses its token. These tests | ||
| # pin both the rename and that retention. | ||
|
|
||
| load 'helpers/setup' | ||
|
|
||
| STUB="${TT_REPO_ROOT}/standards/workflows/pr-review-mention.yml" | ||
|
|
||
| # ── the rename: workflows PAT sourced from GH_PAT_DON_PETRY with old-name fallback | ||
|
|
||
| @test "stub: GH_PAT_WORKFLOWS input uses the GH_PAT_DON_PETRY || GH_PAT_WORKFLOWS fallback" { | ||
| run yq -r '.jobs.pr-review-mention.secrets.GH_PAT_WORKFLOWS' "$STUB" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = '${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}' ] | ||
| } | ||
|
|
||
| # ── fail-closed: the bot-comment PAT must not silently drop out of the wiring ── | ||
|
|
||
| @test "stub: retains DON_PETRY_BOT_GH_PAT (required by the reusable's ack step)" { | ||
| run yq -r '.jobs.pr-review-mention.secrets.DON_PETRY_BOT_GH_PAT' "$STUB" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = '${{ secrets.DON_PETRY_BOT_GH_PAT }}' ] | ||
| } | ||
|
|
||
| @test "stub: uses an explicit secrets mapping, not bare 'inherit'" { | ||
| # With `secrets: inherit`, .secrets is a scalar string; the explicit block is a | ||
| # mapping. An explicit block is what lets us rewire GH_PAT_WORKFLOWS per #791. | ||
| run yq -r '.jobs.pr-review-mention.secrets | tag' "$STUB" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = '!!map' ] | ||
| } | ||
|
|
||
| # ── contract this stub depends on: both PATs are required by the reusable ────── | ||
|
|
||
| @test "reusable: declares GH_PAT_WORKFLOWS and DON_PETRY_BOT_GH_PAT as required" { | ||
| run yq -r '.on.workflow_call.secrets.GH_PAT_WORKFLOWS.required' "$TT_WORKFLOW" | ||
| [ "$output" = 'true' ] | ||
| run yq -r '.on.workflow_call.secrets.DON_PETRY_BOT_GH_PAT.required' "$TT_WORKFLOW" | ||
| [ "$output" = 'true' ] | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency and robustness, we should assert that the
yqcommand executed successfully ([ "$status" -eq 0 ]) before asserting on its output. This matches the pattern used in the other tests in this file.