ci: check whitespace in committed PR/push range (WealthLedger/specs#2)
Specs security / security (pull_request) Canceled after 0s
Specs verify / verify (pull_request) Canceled after 0s
Conventional commits / commits (pull_request) Canceled after 9s

This commit is contained in:
2026-11-02 20:28:20 +03:00
parent 97f358545f
commit 45e871c0f2
2 changed files with 23 additions and 6 deletions
+18 -4
View File
@@ -15,8 +15,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/checkout@v4
- uses: https://github.com/actions/setup-node@v4
with:
node-version-file: .nvmrc
- run: npm ci
- run: npm run verify
fetch-depth: 0
- name: Check whitespace in committed range
env:
PR_BASE: ${{ github.event.pull_request.base.sha }}
PR_HEAD: ${{ github.event.pull_request.head.sha }}
PUSH_BEFORE: ${{ github.event.before }}
PUSH_AFTER: ${{ github.sha }}
run: |
if [ -n "$PR_HEAD" ]; then
range="$PR_BASE...$PR_HEAD"
elif [ -n "$PUSH_BEFORE" ] && ! expr "$PUSH_BEFORE" : '0*$' >/dev/null; then
range="$PUSH_BEFORE..$PUSH_AFTER"
else
# New branch / unknown before: only the pushed commit; full tree would hit read-only archives.
range="$PUSH_AFTER^..$PUSH_AFTER"
fi
echo "Checked revision: $(git rev-parse HEAD); range: $range"
git diff --check "$range"