Skip to content

Commit ba8b575

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 fbb3335 commit ba8b575

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
@@ -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

0 commit comments

Comments
 (0)