|
| 1 | +name: Reusable check HTML IDs |
| 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 | + name: 'Check for removed HTML IDs' |
| 15 | + runs-on: ubuntu-latest |
| 16 | + timeout-minutes: 30 |
| 17 | + steps: |
| 18 | + - name: 'Check out base commit' |
| 19 | + uses: actions/checkout@v6 |
| 20 | + with: |
| 21 | + persist-credentials: false |
| 22 | + ref: ${{ github.event.pull_request.base.sha }} |
| 23 | + - name: 'Set up Python' |
| 24 | + uses: actions/setup-python@v6 |
| 25 | + with: |
| 26 | + python-version: '3' |
| 27 | + cache: 'pip' |
| 28 | + cache-dependency-path: 'Doc/requirements.txt' |
| 29 | + - name: 'Install build dependencies' |
| 30 | + run: make -C Doc/ venv |
| 31 | + - name: 'Build HTML documentation' |
| 32 | + run: make -C Doc/ SPHINXOPTS="--quiet" html |
| 33 | + - name: 'Check out PR head tools' |
| 34 | + uses: actions/checkout@v6 |
| 35 | + with: |
| 36 | + persist-credentials: false |
| 37 | + sparse-checkout: | |
| 38 | + Doc/tools/check-html-ids.py |
| 39 | + Doc/tools/removed-ids.txt |
| 40 | + sparse-checkout-cone-mode: false |
| 41 | + path: pr-head |
| 42 | + - name: 'Use PR head tools' |
| 43 | + run: | |
| 44 | + cp pr-head/Doc/tools/check-html-ids.py Doc/tools/check-html-ids.py |
| 45 | + [ -f pr-head/Doc/tools/removed-ids.txt ] && cp pr-head/Doc/tools/removed-ids.txt Doc/tools/removed-ids.txt |
| 46 | + - name: 'Collect HTML IDs' |
| 47 | + run: python Doc/tools/check-html-ids.py collect Doc/build/html -o /tmp/html-ids-base.json.gz |
| 48 | + - name: 'Download PR head HTML IDs' |
| 49 | + uses: actions/download-artifact@v8 |
| 50 | + with: |
| 51 | + name: html-ids-head.json.gz |
| 52 | + path: /tmp |
| 53 | + - name: 'Check for removed HTML IDs' |
| 54 | + run: | |
| 55 | + # shellcheck disable=SC2046 |
| 56 | + python Doc/tools/check-html-ids.py -v check \ |
| 57 | + /tmp/html-ids-base.json.gz /tmp/html-ids-head.json.gz \ |
| 58 | + $([ -f Doc/tools/removed-ids.txt ] && echo "--exclude-file Doc/tools/removed-ids.txt") |
0 commit comments