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 @@ -387,10 +387,13 @@ jobs:
387387 bug
388388 documentation
389389 - name : Fail on link check error
390- # Exit codes: 0=success, 1=runtime errors/timeouts, 2=broken links found
391- # Only fail on actual broken links (exit code 2), not timeouts (exit code 1)
392- if : ${{ !inputs.skip_linkcheck && !cancelled() && steps.linkchecker.outputs.exit_code == '2' && env.INPUT_FAIL_ON_ERROR == 'true' }}
393- uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
394- with :
395- script : |
396- core.setFailed('Link checker detected broken or invalid links, read attached report.')
390+ # Check report for actual broken links (ERROR, 4xx, 5xx), not timeouts
391+ if : ${{ !inputs.skip_linkcheck && !cancelled() && env.INPUT_FAIL_ON_ERROR == 'true' }}
392+ run : |
393+ if [ -f "html-link-report.md" ]; then
394+ ERRORS=$(grep -cE "^\[ERROR\]|^\[[45][0-9]{2}\]" html-link-report.md 2>/dev/null) || ERRORS=0
395+ if [ "$ERRORS" -gt 0 ]; then
396+ echo "::error::Link checker found $ERRORS broken link(s). See report for details."
397+ exit 1
398+ fi
399+ fi
You can’t perform that action at this time.
0 commit comments