verify ran git diff --check on a clean checkout (always no-op). Now checks PR merge-base..head or push before..after; zero before falls back to the last commit. Node setup removed from the git-only job.
37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
name: Specs verify
|
|
|
|
on:
|
|
push:
|
|
branches: [develop, main]
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
concurrency:
|
|
group: specs-verify-${{ gitea.event_name }}-${{ gitea.event.pull_request.number || gitea.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
verify:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
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"
|