Skip to content

Commit e661e62

Browse files
lychee updated (#7207)
* lychee yodated * test link thats broken * cache exclude on second try * tanstack link fixed * lychee update
1 parent c243677 commit e661e62

File tree

1 file changed

+52
-9
lines changed

1 file changed

+52
-9
lines changed

.github/workflows/lychee.yml

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18-
- name: 🍈 Lychee Link Checker
18+
- name: 🍈 Lychee Link Checker (First Run)
1919
id: lychee
2020
uses: lycheeverse/lychee-action@v2
2121
with:
2222
fail: false
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
@@ -39,23 +40,58 @@ jobs:
3940
env:
4041
GITHUB_TOKEN: ${{ secrets.github_token }}
4142

43+
- name: 🔄 Retry Lychee Link Checker (Second Run for Timeouts)
44+
id: lychee-retry
45+
if: ${{ always() && steps.lychee.outputs.exit_code != 0 }}
46+
uses: lycheeverse/lychee-action@v2
47+
with:
48+
fail: false
49+
output: ../lychee/out-retry.md
50+
args: >
51+
--cache
52+
--max-cache-age 5m
53+
--verbose
54+
--no-progress
55+
--accept 200,201,204,304,403,429
56+
--cache-exclude-status 429,500,502,503,504
57+
--timeout 30
58+
--max-retries 10
59+
--retry-wait-time 10
60+
--exclude 'http://localhost.*'
61+
--exclude 'https://localhost.*'
62+
--exclude 'https://cockroachlabs.com'
63+
--exclude '^/.*'
64+
'./**/*.md' './**/*.mdx'
65+
workingDirectory: "content"
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.github_token }}
68+
4269
- name: 📝 Clean up Lychee Report
4370
if: ${{ always() && github.event.pull_request.head.repo.fork == false }}
4471
run: |
45-
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
4682
# Read the original output
47-
ORIGINAL=$(cat lychee/out.md)
48-
83+
ORIGINAL=$(cat "$REPORT_FILE")
84+
4985
# Create formatted output
50-
cat > lychee/formatted.md << 'EOF'
86+
cat > lychee/formatted.md << EOF
5187
## 🍈 Lychee Link Check Report
5288
53-
> **Note:** Links are cached for 5 minutes to avoid unnecessary requests, and speed up consecutive runs.
89+
> **Note:** $NOTE
5490
5591
### 📊 Results Overview
5692
5793
EOF
58-
94+
5995
# Append the original content with title replacement
6096
echo "$ORIGINAL" | sed 's/^# Summary$//' | sed 's/^## Summary$//' >> lychee/formatted.md
6197
fi
@@ -68,5 +104,12 @@ jobs:
68104
body-path: lychee/formatted.md
69105

70106
- name: 🚫 Fail if broken links found
71-
if: ${{ steps.lychee.outputs.exit_code != 0 }}
72-
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 == 'failure' }}
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

Comments
 (0)