-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ci): governance-enforce gate can pass having scanned nothing #35
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ name: governance-enforce | |
|
|
||
| on: | ||
| pull_request: | ||
| merge_group: | ||
| push: | ||
| branches: [main, master] | ||
|
|
||
|
|
@@ -39,11 +40,17 @@ jobs: | |
| - name: A_BLOCK enforce (secrets + hardcoded paths on the diff) | ||
| env: | ||
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
| MERGE_BASE_SHA: ${{ github.event.merge_group.base_sha }} | ||
| PUSH_BEFORE_SHA: ${{ github.event.before }} | ||
| run: | | ||
| BASE="${PR_BASE_SHA:-$PUSH_BEFORE_SHA}" | ||
| BASE="${PR_BASE_SHA:-${MERGE_BASE_SHA:-$PUSH_BEFORE_SHA}}" | ||
| if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then | ||
| BASE=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD) | ||
| # Indeterminate base (first push / force-push). Do NOT silently scan a partial range — | ||
| # HEAD~1 would skip earlier commits in a multi-commit push and let a violation through | ||
| # (a config-no-silent-noop hole). Diff the full tree against git's empty-tree object so | ||
| # every introduced file is scanned; loud, never a silent empty/partial pass. | ||
| BASE=$(git hash-object -t tree /dev/null) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 Enforcer may not accept a bare tree object as the diff base
Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| echo "::warning::indeterminate diff base; scanning full tree (empty-tree base) so no commit is skipped" | ||
|
Comment on lines
+48
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Force-pushes and first pushes now fail the required check on pre-existing issues When the starting point for the comparison cannot be determined, the check now compares against an empty starting point ( Fallback base switches the gate from diff-scoped to whole-repository scopeThe workflow header ( A less disruptive option is to keep a loud warning but resolve a real commit base (e.g. Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| fi | ||
| echo "diffing against $BASE" | ||
| node "$RUNNER_TEMP/gov/node_modules/@wave-av/governance/bin/enforce.mjs" --changed "$BASE" | ||
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.
🔍 merge_group only added to this workflow
This is the only workflow in
.github/workflows/with amerge_grouptrigger (the others —_checks.yml,foundation-gate.yml,public-repo-guard.yml— are PR/push only). If a merge queue is enabled and those checks are also required, they will never report on queue entries and could stall the queue. Confirm the queue's required-check set matches the workflows that actually trigger onmerge_group.Was this helpful? React with 👍 or 👎 to provide feedback.