File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 43
43
run : |
44
44
cd docs
45
45
make linkcheck SPHINXOPTS='--color -W --keep-going'
46
+
47
+ - name : summarise linkcheck issues
48
+ if : always()
49
+ run : |
50
+ ./ci/summarise-linkcheck-output ./docs/_build/linkcheck/output.json
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Parse the output.json created by the Sphinx linkchecker
3
+ # and summarise broken and redirected links
4
+
5
+ set -eu
6
+ LINKCHECK=" $1 "
7
+
8
+ N_BROKEN=$( jq -r ' select(.status=="broken")' " $LINKCHECK " | jq -s length)
9
+ N_PERMANENT_REDIRECT=$( jq -r ' select(.status=="redirected")' " $LINKCHECK " | jq -s length)
10
+
11
+ # shellcheck disable=SC2086
12
+ if [[ $N_BROKEN -gt 0 ]]; then
13
+ printf " \n\033[31;1m%s\033[0m\n" " Broken links"
14
+ jq -r ' select(.status=="broken") | "\(.filename):\(.lineno) \(.uri)\n \(.info)"' " $LINKCHECK "
15
+ fi
16
+
17
+ # shellcheck disable=SC2086
18
+ if [[ $N_PERMANENT_REDIRECT -gt 0 ]]; then
19
+ printf " \n\033[35;1m%s\033[0m\n" " Permanently redirected links"
20
+ jq -r ' select(.status=="redirected" and .code==301) | "\(.filename):\(.lineno) \(.uri)\n \(.info)"' " $LINKCHECK "
21
+ fi
22
+
23
+ exit " $N_BROKEN "
You can’t perform that action at this time.
0 commit comments