Skip to content

Commit 1a74d00

Browse files
authored
Update broken-links.yml
1 parent b240b66 commit 1a74d00

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/broken-links.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,17 @@ jobs:
3131
3232
- name: Annotate Results
3333
run: |
34-
if grep -q "✖" link-check-results.txt; then
34+
# Extract broken links
35+
broken_links=$(grep -B 1 "✖" link-check-results.txt || true)
36+
37+
if [ -n "$broken_links" ]; then
3538
echo "::error title=Broken Links Found::The following links are broken:"
36-
grep -B 1 "✖" link-check-results.txt | sed 's/%/%25/g; s/\n/%0A/g; s/\r/%0D/g'
37-
echo "Full Details:"
38-
cat link-check-results.txt | grep -B 1 "✖"
39+
echo "$broken_links" | sed 's/%/%25/g; s/\n/%0A/g; s/\r/%0D/g'
40+
41+
# Print broken links in console for debugging
42+
echo "Broken Links Details:"
43+
echo "$broken_links"
44+
3945
exit 1
4046
else
4147
echo "::notice title=All Links Valid::All links in the README are valid."

0 commit comments

Comments
 (0)