File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments