-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (44 loc) · 1.87 KB
/
Copy pathvalidate.yml
File metadata and controls
56 lines (44 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Validate Taxonomy
on:
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Reject manual dist edits in PR
run: |
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
# Try to make both SHAs available locally; base is always in origin,
# head may come from a fork and may already be present via checkout.
git fetch --no-tags --prune --depth=1 origin "${BASE_SHA}" || true
git fetch --no-tags --prune --depth=1 origin "${HEAD_SHA}" || true
if git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null && git cat-file -e "${HEAD_SHA}^{commit}" 2>/dev/null; then
CHANGED="$(git diff --name-only "${BASE_SHA}" "${HEAD_SHA}")"
elif git rev-parse HEAD^1 >/dev/null 2>&1 && git rev-parse HEAD^2 >/dev/null 2>&1; then
# Fallback for PR merge refs checked out by actions/checkout.
CHANGED="$(git diff --name-only HEAD^1 HEAD^2)"
else
echo "Unable to compute changed files for this pull request."
exit 1
fi
echo "$CHANGED"
if echo "$CHANGED" | grep -q '^dist/'; then
echo "Do not edit dist/ in pull requests."
echo "Edit taxonomy/ source files only; dist is generated automatically after merge."
exit 1
fi
- name: Install dependencies
run: pip install -r requirements.txt
- name: Validate taxonomy
run: python tools/validate.py
- name: Lint markdown links and ID references
run: python tools/lint-links.py
- name: Build generated taxonomy
run: python tools/build.py