Skip to content

Commit 52ced6f

Browse files
Only run on PRs + move to reusable workflow
1 parent c5031ad commit 52ced6f

File tree

2 files changed

+48
-31
lines changed

2 files changed

+48
-31
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Reusable Check HTML IDs Check
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
env:
10+
FORCE_COLOR: 1
11+
12+
jobs:
13+
check-html-ids:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 30
16+
steps:
17+
- name: 'Check out base commit'
18+
uses: actions/checkout@v6
19+
with:
20+
persist-credentials: false
21+
ref: ${{ github.event.pull_request.base.sha }}
22+
- name: 'Set up Python'
23+
uses: actions/setup-python@v6
24+
with:
25+
python-version: '3'
26+
cache: 'pip'
27+
cache-dependency-path: 'Doc/requirements.txt'
28+
- name: 'Install build dependencies'
29+
run: make -C Doc/ venv
30+
- name: 'Build HTML documentation'
31+
run: make -C Doc/ SPHINXOPTS="--quiet" html
32+
- name: 'Collect HTML IDs'
33+
run: python Doc/tools/check-html-ids.py collect Doc/build/html -o /tmp/html-ids-base.json.gz
34+
- name: 'Download PR base HTML IDs'
35+
uses: actions/download-artifact@v8
36+
with:
37+
name: html-ids-head.json.gz
38+
path: /tmp
39+
- name: 'Check for removed HTML IDs'
40+
run: >-
41+
python Doc/tools/check-html-ids.py check
42+
/tmp/html-ids-base.json.gz /tmp/html-ids-head.json.gz
43+
# XXX: When an exclude file is added, update this to use it:
44+
# --exclude-file Doc/tools/removed-ids.txt

.github/workflows/reusable-docs.yml

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ jobs:
7676
--fail-if-improved \
7777
--fail-if-new-news-nit
7878
- name: 'Collect HTML IDs'
79+
if: github.event_name == 'pull_request'
7980
run: python Doc/tools/check-html-ids.py collect Doc/build/html -o Doc/build/html-ids-head.json.gz
8081
- name: 'Upload HTML IDs'
82+
if: github.event_name == 'pull_request'
8183
uses: actions/upload-artifact@v7
8284
with:
8385
name: html-ids-head
@@ -87,37 +89,8 @@ jobs:
8789
check-html-ids:
8890
name: 'Check for removed HTML IDs'
8991
needs: build-doc
90-
runs-on: ubuntu-latest
91-
timeout-minutes: 30
92-
steps:
93-
- name: 'Check out base commit'
94-
uses: actions/checkout@v6
95-
with:
96-
persist-credentials: false
97-
ref: ${{ github.event.pull_request.base.sha || github.event.before }}
98-
- name: 'Set up Python'
99-
uses: actions/setup-python@v6
100-
with:
101-
python-version: '3'
102-
cache: 'pip'
103-
cache-dependency-path: 'Doc/requirements.txt'
104-
- name: 'Install build dependencies'
105-
run: make -C Doc/ venv
106-
- name: 'Build HTML documentation'
107-
run: make -C Doc/ SPHINXOPTS="--quiet" html
108-
- name: 'Collect HTML IDs'
109-
run: python Doc/tools/check-html-ids.py collect Doc/build/html -o /tmp/html-ids-base.json.gz
110-
- name: 'Download PR base HTML IDs'
111-
uses: actions/download-artifact@v8
112-
with:
113-
name: html-ids-head.json.gz
114-
path: /tmp
115-
- name: 'Check for removed HTML IDs'
116-
run: >-
117-
python Doc/tools/check-html-ids.py check
118-
/tmp/html-ids-base.json.gz /tmp/html-ids-head.json.gz
119-
# XXX: When an exclude file is added, update this to use it:
120-
# --exclude-file Doc/tools/removed-ids.txt
92+
if: github.event_name == 'pull_request'
93+
uses: ./.github/workflows/reusable-check-html-ids.yml
12194

12295
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
12396
doctest:

0 commit comments

Comments
 (0)