Skip to content

Commit 51a8cba

Browse files
committed
Refine GitHub Actions workflow to improve link check error handling by preventing immediate exit on failure and adding a reporting step after posting comments.
1 parent f8f746b commit 51a8cba

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.github/workflows/check-links.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,7 @@ jobs:
118118
# Save failed status to output
119119
echo "failed=$FAILED" >> $GITHUB_OUTPUT
120120
121-
# Exit with failure if any checks failed
122-
if [[ "$FAILED" == "true" ]]; then
123-
echo "::error::One or more link checks failed. Please fix the broken links."
124-
exit 1
125-
fi
121+
# Do not exit with error - we want to post the comment first
126122
127123
- name: Find Comment
128124
uses: peter-evans/find-comment@v3
@@ -141,3 +137,10 @@ jobs:
141137
issue-number: ${{ github.event.pull_request.number }}
142138
body: ${{ steps.create-summary.outputs.comment_body }}
143139
edit-mode: replace
140+
141+
# This step runs after comment is posted and fails the workflow if links are broken
142+
- name: Report Link Check Status
143+
if: steps.create-summary.outputs.failed == 'true'
144+
run: |
145+
echo "::error::One or more link checks failed. Please fix the broken links."
146+
exit 1

0 commit comments

Comments
 (0)