Skip to content

Validate JSON response shapes #1

Validate JSON response shapes

Validate JSON response shapes #1

---
name: Inline suppression guard
on:
pull_request:
permissions: {}
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Reject new inline suppressions
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
added_lines="$(
git diff --unified=0 "$BASE_SHA" "$HEAD_SHA" -- '*.py' |
sed -n '/^+++ /d; s/^+//p'
)"
suppressions="$(
printf '%s\n' "$added_lines" |
grep -Ei '#[[:space:]]*(type:[[:space:]]*ignore|pyright:[[:space:]]*ignore|pyrefly:[[:space:]]*ignore|ty:[[:space:]]*ignore|mypy:[[:space:]]*ignore|pylint:[[:space:]]*disable|noqa($|[[:space:]])|pragma:[[:space:]]*no[[:space:]]+(cover|branch))' ||
true
)"
if [ -n "$suppressions" ]; then
printf '%s\n' "New inline suppressions are not allowed:"
printf '%s\n' "$suppressions"
exit 1
fi