ci: add guard against zero-change PRs (rubber-stamp prevention)
Some checks failed
CI / test (pull_request) Failing after 1m53s
CI / validate (pull_request) Failing after 13s
Review Approval Gate / verify-review (pull_request) Failing after 13s

Add early-failing check to reject PRs with zero file changes.
This prevents the "rubber-stamping" problem where reviewers
approve empty diffs (0 additions, 0 deletions).

The check runs in the validate job immediately after checkout:
- Counts changed files via git diff --name-only origin/main...HEAD
- Fails if count is zero with clear error message
- Passes with confirmation if PR has real changes

Refs #1445. Addresses Option 1 (CI Validation) from issue triage.
Smallest concrete fix: one new step in existing CI workflow.

Closes #1445
This commit is contained in:
Timmy Step35
2026-04-30 18:58:28 -04:00
parent 60e8b62a79
commit f7f96bc744

View File

@@ -38,6 +38,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: "Guard: reject PRs with zero file changes"
run: |
CHANGED=$(git diff --name-only origin/main...HEAD | wc -l | tr -d ' ')
echo "Changed files: $CHANGED"
if [ "$CHANGED" -eq 0 ]; then
echo ""
echo "═══════════════════════════════════════════════════"
echo " BLOCKED: PR contains zero file changes."
echo " This indicates rubber-stamping — approving without"
echo " actually making any modifications."
echo " Make real changes before requesting review."
echo "═══════════════════════════════════════════════════"
exit 1
fi
echo "✓ PR has $CHANGED changed file(s)."
- name: Validate Python syntax
run: |
FAIL=0