1- name : linkchecker
1+ name : Link Checker
22
33on :
44 workflow_dispatch :
@@ -14,38 +14,98 @@ permissions:
1414 contents : read
1515
1616jobs :
17- build :
17+ check-links :
18+ name : Check Documentation Links
1819 if : github.event.pull_request.merged == true
1920 runs-on : ubuntu-latest
2021 steps :
21- - name : get
22+ - name : Checkout Repository
2223 uses : actions/checkout@v4
2324
24- - name : install
25+ - name : Install System Dependencies
2526 run : |
26- sudo apt install -y libunwind-dev
27- sudo apt install -y graphviz
28- sudo apt install -y --no-install-recommends doxygen
29- sudo apt install -y cmake
30- pip3 install linkchecker
27+ sudo apt-get update
28+ sudo apt-get install -y --no-install-recommends \
29+ libunwind-dev \
30+ graphviz \
31+ doxygen \
32+ cmake
3133
32- - name : build
34+ - name : Build Documentation
35+ id : build_docs
3336 run : |
3437 mkdir build
3538 cd build
3639 cmake -DHDF5_BUILD_DOC:BOOL=ON ..
3740 make doxygen
41+ echo "html_path=$(pwd)/hdf5lib_docs/html" >> $GITHUB_OUTPUT
3842
39- - name : check
43+ - name : Run Comprehensive Link Check
44+ id : lychee
45+ uses :
lycheeverse/[email protected] 46+ with :
47+ args : >
48+ --verbose
49+ --base ${{ steps.build_docs.outputs.html_path }}
50+ --max-retries 4
51+ --max-concurrency 8
52+ --retry-wait-time 10
53+ --timeout 30
54+ --user-agent "Mozilla/5.0 (compatible; Lychee/v0.1)"
55+ --exclude "eigen.tuxfamily.org"
56+ --exclude "gnu.org"
57+ --exclude "en.wikipedia.org"
58+ --exclude "help.hdfgroup.org"
59+ --exclude "libpng.org"
60+ --exclude "my.cdash.org"
61+ --exclude "www.oreilly.com"
62+ --exclude "preshing.com"
63+ --exclude "semver.org"
64+ --exclude "sourceforge.net"
65+ --exclude "www.youtube.com"
66+ --exclude "youtu.be"
67+ --exclude "hdfeos.org"
68+ --exclude "github.com"
69+ --exclude "stackoverflow.com"
70+ --exclude "reddit.com"
71+ --exclude "twitter.com"
72+ --exclude "linkedin.com"
73+ "${{ steps.build_docs.outputs.html_path }}/**/*.html"
74+ output : lychee-report.md
75+ format : markdown
76+ # Let the action fail naturally - we'll handle it in the summary step
77+ fail : true
78+
79+ - name : Publish Report to Job Summary
80+ if : always()
4081 run : |
41- cd build/hdf5lib_docs/html
42- linkchecker --no-warnings --ignore-url=eigen.tuxfamily.org --ignore-url=/doxygen.css \
43- --ignore-url=gnu.org --ignore-url=en.wikipedia.org \
44- --ignore-url=help.hdfgroup.org --ignore-url=libpng.org \
45- --ignore-url=my.cdash.org --ignore-url=www.oreilly.com \
46- --ignore-url=preshing.com --ignore-url=semver.org \
47- --ignore-url=sourceforge.net --ignore-url=www.youtube.com \
48- --ignore-url=youtu.be \
49- --check-extern --threads=2 ./index.html
50- # continue-on-error: true
82+ echo "## 🔗 Link Checker Report" >> "$GITHUB_STEP_SUMMARY"
83+
84+ # Check if lychee step succeeded or failed
85+ if [ "${{ steps.lychee.outcome }}" = "success" ]; then
86+ echo "✅ **No broken links found!**" >> "$GITHUB_STEP_SUMMARY"
87+ elif [ "${{ steps.lychee.outcome }}" = "failure" ]; then
88+ # Count actual broken links marked with the ❌ emoji.
89+ # Default to 0 if grep finds nothing or fails.
90+ FAILED_COUNT=$(grep -c "❌" lychee-report.md 2>/dev/null || echo 0)
5191
92+ if [ "$FAILED_COUNT" -gt 0 ]; then
93+ echo "❌ **Found $FAILED_COUNT broken link(s)!**" >> "$GITHUB_STEP_SUMMARY"
94+ else
95+ # If the step failed but no broken links found, it's likely a different error
96+ echo "⚠️ **Link checker encountered an error.**" >> "$GITHUB_STEP_SUMMARY"
97+ echo "This may indicate a configuration, network, or file access issue." >> "$GITHUB_STEP_SUMMARY"
98+ fi
99+ else
100+ echo "⚠️ **Link checker step was skipped or cancelled.**" >> "$GITHUB_STEP_SUMMARY"
101+ fi
102+
103+ echo "" >> "$GITHUB_STEP_SUMMARY"
104+ echo "### Full Report:" >> "$GITHUB_STEP_SUMMARY"
105+ if [ -f "lychee-report.md" ]; then
106+ echo '```' >> "$GITHUB_STEP_SUMMARY"
107+ cat lychee-report.md >> "$GITHUB_STEP_SUMMARY"
108+ echo '```' >> "$GITHUB_STEP_SUMMARY"
109+ else
110+ echo "No detailed report available." >> "$GITHUB_STEP_SUMMARY"
111+ fi
0 commit comments