Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1ae244b
fix(standards): pin auto-rebase stub to SHA to satisfy SonarCloud sec…
don-petry Apr 28, 2026
95c494b
ci: trigger CI with clean check-suite preferences
don-petry May 6, 2026
5b0640c
fix(compliance): accept SHA-pinned reusable refs in centralized-stub …
github-actions[bot] May 6, 2026
851c796
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
github-actions[bot] May 13, 2026
60f33db
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
github-actions[bot] May 13, 2026
d5f7bc2
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 14, 2026
4c18eb1
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 14, 2026
3318938
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 15, 2026
cddbae3
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 15, 2026
7877e18
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 16, 2026
b412a1d
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 16, 2026
0daffc6
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 16, 2026
55fb3e5
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 16, 2026
6f61b5a
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 16, 2026
4a23f8f
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
644af4d
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
670c115
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
817b9b9
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
a0d3196
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
13fd820
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
8640eaf
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
b2eee6e
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
f9f4031
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
332fadb
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
d07f212
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
d5a34c5
Merge branch 'main' into fix/auto-rebase-stub-sha-pin
don-petry May 17, 2026
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
37 changes: 25 additions & 12 deletions scripts/compliance-audit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -697,14 +697,21 @@ check_ci_concurrency() {
}

# ---------------------------------------------------------------------------
# Check: Tier 1 centralized workflows must be thin caller stubs pinned to @v1
# Check: Tier 1 centralized workflows must be thin caller stubs using an
# immutable SHA pin (preferred) or @v1 tag (legacy, still accepted).
#
# For each workflow that the org has centralized into a reusable workflow,
# verify the downstream repo's copy is a stub that delegates via:
# uses: petry-projects/.github/.github/workflows/<reusable>.yml@<40-hex-SHA> # v1
# or (legacy, still accepted):
# uses: petry-projects/.github/.github/workflows/<reusable>.yml@v1
#
# SHA-pinned references are preferred because mutable tags (@v1) are flagged
# as Security Hotspots by SonarCloud. The canonical stub in
# standards/workflows/ uses the SHA-pinned format.
#
# This prevents drift: a repo that copies the inline pre-centralization
# version (or pins to @main, or pins to an older tag) is flagged so it
# version (or pins to @main, or pins to an older SHA/tag) is flagged so it
# can be re-synced from the standard. The central .github repo itself is
# exempt because it owns the reusables and may legitimately reference
# its own workflows by @main during release prep.
Expand Down Expand Up @@ -753,28 +760,34 @@ check_centralized_workflow_stubs() {
decoded=$(echo "$content" | base64 -d 2>/dev/null || echo "")
[ -z "$decoded" ] && continue

# Required pattern: a non-comment line whose `uses:` value is exactly
# petry-projects/.github/.github/workflows/<reusable>.yml@v1
# Anchor to start-of-line + optional indent so a `# uses: ...` comment
# cannot satisfy the check.
local expected="petry-projects/\\.github/\\.github/workflows/${reusable}\\.yml@v1"

if echo "$decoded" | grep -qE "^[[:space:]]*uses:[[:space:]]*${expected}([[:space:]]|$)"; then
continue # stub is correctly pinned to @v1 — compliant
# Accept two canonical forms — anchor to start-of-line + optional indent so
# a `# uses: ...` comment cannot satisfy the check.
#
# Preferred (SHA-pinned, satisfies SonarCloud security gate):
# uses: petry-projects/.github/.github/workflows/<reusable>.yml@<40-hex-SHA> [# comment]
# Legacy (still accepted for backwards compatibility):
# uses: petry-projects/.github/.github/workflows/<reusable>.yml@v1
local base="petry-projects/\\.github/\\.github/workflows/${reusable}\\.yml"

if echo "$decoded" | grep -qE "^[[:space:]]*uses:[[:space:]]*${base}@[0-9a-f]{40}([[:space:]]|$)"; then
continue # SHA-pinned reference to canonical reusable — compliant
fi
if echo "$decoded" | grep -qE "^[[:space:]]*uses:[[:space:]]*${base}@v1([[:space:]]|$)"; then
continue # @v1 tag reference — compliant (SHA-pinned preferred; see canonical stub)
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

# Determine why it's non-compliant for a more actionable message.
local why
if echo "$decoded" | grep -qE "^[[:space:]]*uses:[[:space:]]*petry-projects/\\.github/\\.github/workflows/${reusable}\\.yml@"; then
why="references the reusable but is not pinned to \`@v1\` (org standard)"
why="references the reusable but is not pinned to a full commit SHA or \`@v1\` (org standard)"
elif echo "$decoded" | grep -qF "petry-projects/.github/.github/workflows/${reusable}"; then
why="references the reusable but the \`uses:\` line does not match the canonical stub"
else
why="is an inline copy instead of a thin caller stub — re-sync from \`standards/workflows/${wf}\`"
fi

add_finding "$repo" "ci-workflows" "non-stub-$wf" "error" \
"Centralized workflow \`$wf\` $why. Replace with the canonical stub from \`standards/workflows/${wf}\` which delegates to \`petry-projects/.github/.github/workflows/${reusable}.yml@v1\`." \
"Centralized workflow \`$wf\` $why. Replace with the canonical stub from \`standards/workflows/${wf}\` which delegates to \`petry-projects/.github/.github/workflows/${reusable}.yml\` using a SHA-pinned reference (see the stub for the current SHA)." \
"standards/ci-standards.md#centralization-tiers"
done
}
Expand Down
2 changes: 1 addition & 1 deletion standards/ci-standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
Without it the sentinel comment still appears but no automatic resolution will run.
Dependabot PRs are excluded because `dependabot-rebase.yml` handles those.

**Compliance:** The compliance audit (`check_centralized_workflow_stubs`) verifies that repos adopting `auto-rebase.yml` use the canonical thin caller stub delegating to `petry-projects/.github/.github/workflows/auto-rebase-reusable.yml@v1`.
**Compliance:** The compliance audit (`check_centralized_workflow_stubs`) verifies that repos adopting `auto-rebase.yml` use the canonical thin caller stub delegating to `petry-projects/.github/.github/workflows/auto-rebase-reusable.yml` with a SHA-pinned reference (e.g. `@126c1441ee9cf040f2ce3ef0eda85d459b82f8e9 # v1`). The `@v1` mutable tag is still accepted for backwards compatibility but SHA-pinned references are preferred to satisfy SonarCloud's supply-chain security gate.

Check failure on line 531 in standards/ci-standards.md

View workflow job for this annotation

GitHub Actions / Lint

Line length

standards/ci-standards.md:531:201 MD013/line-length Line length [Expected: 200; Actual: 482] https://github.com/DavidAnson/markdownlint/blob/v0.40.0/doc/md013.md
Comment thread
coderabbitai[bot] marked this conversation as resolved.

### 10. PR Review Mention (`pr-review-mention.yml`)

Expand Down
2 changes: 1 addition & 1 deletion standards/workflows/auto-rebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ jobs:
permissions:
contents: write # update-branch via GITHUB_TOKEN (may touch .github/workflows/)
pull-requests: write # post comments on PRs
uses: petry-projects/.github/.github/workflows/auto-rebase-reusable.yml@v1
uses: petry-projects/.github/.github/workflows/auto-rebase-reusable.yml@126c1441ee9cf040f2ce3ef0eda85d459b82f8e9 # v1
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change updates the canonical stub to a SHA-pinned uses: reference, but the compliance audit still hard-codes @v1 as the only acceptable pattern (see scripts/compliance-audit.sh check_centralized_workflow_stubs, which matches ...@v1 exactly). As-is, repos that adopt this updated stub will be flagged as non-compliant. Update the audit check to accept the SHA-pinned form (optionally with a trailing # v1 comment) or to compare against the canonical stub content instead of @v1.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation now becomes stale: standards/ci-standards.md currently states the canonical stub delegates to .../auto-rebase-reusable.yml@v1 (around line 514), but this file now uses a SHA. Please update the doc reference to match the new canonical format so adopters and the standard remain consistent.

Suggested change
uses: petry-projects/.github/.github/workflows/auto-rebase-reusable.yml@126c1441ee9cf040f2ce3ef0eda85d459b82f8e9 # v1
uses: petry-projects/.github/.github/workflows/auto-rebase-reusable.yml@126c1441ee9cf040f2ce3ef0eda85d459b82f8e9 # pinned SHA

Copilot uses AI. Check for mistakes.
secrets: inherit
Loading