ci: check whitespace in committed PR/push range (WealthLedger/specs#2)
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user