File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,16 +20,38 @@ jobs:
2020 - uses : actions/checkout@v4
2121 with :
2222 # The committed Pages dump contains over a million generated files.
23- # Validation only needs records and the bundled validator.
23+ # Start with the validator and its tests. Data is added only when
24+ # the pull request actually changes a record.
2425 sparse-checkout : |
26+ .github
2527 app
26- data
28+ tests
2729 sparse-checkout-cone-mode : true
2830 - uses : actions/setup-python@v5
2931 with :
3032 python-version : " 3.12"
33+ - name : Select validation scope
34+ id : scope
35+ env :
36+ GH_TOKEN : ${{ github.token }}
37+ shell : bash
38+ run : |
39+ if [[ "${{ github.event_name }}" == "push" ]]; then
40+ echo "scope=full" >> "$GITHUB_OUTPUT"
41+ elif gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}/files" --jq '.[].filename' | grep -q '^data/'; then
42+ echo "scope=full" >> "$GITHUB_OUTPUT"
43+ else
44+ echo "scope=tests" >> "$GITHUB_OUTPUT"
45+ fi
3146 - name : Self-check (bundled validator)
32- run : python -m app.validate
47+ shell : bash
48+ run : |
49+ if [[ "${{ steps.scope.outputs.scope }}" == "full" ]]; then
50+ git sparse-checkout add data
51+ python -m app.validate
52+ else
53+ python -m unittest discover -s tests -v
54+ fi
3355
3456 engine-validate :
3557 needs : self-validate
You can’t perform that action at this time.
0 commit comments