2323 output : ../lychee/out.md
2424 args : >
2525 --cache
26+ --cache-exclude-status 429,500,502,503,504
2627 --max-cache-age 5m
2728 --verbose
2829 --no-progress
5253 --verbose
5354 --no-progress
5455 --accept 200,201,204,304,403,429
56+ --cache-exclude-status 429,500,502,503,504
5557 --timeout 30
5658 --max-retries 10
5759 --retry-wait-time 10
@@ -67,20 +69,29 @@ jobs:
6769 - name : 📝 Clean up Lychee Report
6870 if : ${{ always() && github.event.pull_request.head.repo.fork == false }}
6971 run : |
70- if [ -f "lychee/out.md" ]; then
72+ # Use retry results if available, otherwise use first run results
73+ if [ -f "lychee/out-retry.md" ]; then
74+ REPORT_FILE="lychee/out-retry.md"
75+ NOTE="Links are cached for 5 minutes. Failed links (timeouts, rate limits) are retried in a second run with longer timeout."
76+ elif [ -f "lychee/out.md" ]; then
77+ REPORT_FILE="lychee/out.md"
78+ NOTE="Links are cached for 5 minutes to avoid unnecessary requests, and speed up consecutive runs."
79+ fi
80+
81+ if [ -n "$REPORT_FILE" ]; then
7182 # Read the original output
72- ORIGINAL=$(cat lychee/out.md )
73-
83+ ORIGINAL=$(cat "$REPORT_FILE" )
84+
7485 # Create formatted output
75- cat > lychee/formatted.md << ' EOF'
86+ cat > lychee/formatted.md << EOF
7687 ## 🍈 Lychee Link Check Report
7788
78- > **Note:** Links are cached for 5 minutes to avoid unnecessary requests, and speed up consecutive runs.
89+ > **Note:** $NOTE
7990
8091 ### 📊 Results Overview
8192
8293 EOF
83-
94+
8495 # Append the original content with title replacement
8596 echo "$ORIGINAL" | sed 's/^# Summary$//' | sed 's/^## Summary$//' >> lychee/formatted.md
8697 fi
@@ -93,5 +104,12 @@ jobs:
93104 body-path : lychee/formatted.md
94105
95106 - name : 🚫 Fail if broken links found
96- if : ${{ steps.lychee.outputs.exit_code != 0 }}
97- run : exit ${{ steps.lychee.outputs.exit_code }}
107+ if : ${{ steps.lychee-retry.conclusion == 'success' && steps.lychee-retry.outputs.exit_code != 0 || steps.lychee-retry.conclusion == 'skipped' && steps.lychee.outputs.exit_code != 0 }}
108+ run : |
109+ if [ "${{ steps.lychee-retry.conclusion }}" == "success" ]; then
110+ echo "Failing based on retry run results"
111+ exit ${{ steps.lychee-retry.outputs.exit_code }}
112+ else
113+ echo "Failing based on first run results"
114+ exit ${{ steps.lychee.outputs.exit_code }}
115+ fi
0 commit comments