Skip to content

Commit 21facb2

Browse files
fix: check report content for broken links instead of exit codes
Timeouts should not cause build failures - only actual broken links (ERROR, 4xx, 5xx)
1 parent 2a64c4d commit 21facb2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,13 @@ jobs:
402402
bug
403403
documentation
404404
- name: Fail on link check error
405-
# Exit codes: 0=success, 1=runtime errors/timeouts, 2=broken links found
406-
# Only fail on actual broken links (exit code 2), not timeouts (exit code 1)
407-
if: ${{ !inputs.skip_linkcheck && !cancelled() && steps.linkchecker.outputs.exit_code == '2' && env.INPUT_FAIL_ON_ERROR == 'true' }}
408-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
409-
with:
410-
script: |
411-
core.setFailed('Link checker detected broken or invalid links, read attached report.')
405+
# Check report for actual broken links (ERROR, 4xx, 5xx), not timeouts
406+
if: ${{ !inputs.skip_linkcheck && !cancelled() && env.INPUT_FAIL_ON_ERROR == 'true' }}
407+
run: |
408+
if [ -f "html-link-report.md" ]; then
409+
ERRORS=$(grep -cE "^\[ERROR\]|^\[[45][0-9]{2}\]" html-link-report.md 2>/dev/null) || ERRORS=0
410+
if [ "$ERRORS" -gt 0 ]; then
411+
echo "::error::Link checker found $ERRORS broken link(s). See report for details."
412+
exit 1
413+
fi
414+
fi

0 commit comments

Comments
 (0)