Skip to content

Commit 4afe5e1

Browse files
DC-5259 Added Lychee Link Checker (#7192)
* added workflow * lychee checker updated * update link again * lychee updated * revert back * edit fail conditions * check 2 * lychee changed * workign dir * args updated * added comment * lychee tol added * edited toml * typo fixed * typos * args renoved * removed include * added extensions * minor updates * update * update * update * arg changes * changed comment system * cache added * test * output fixed * broken link to test * fail on broken links * sytyle changes * file path change * conflict * exclusions * timeout and cache changes * quiet flag * name change and old toml file removed * tanstack fixed * cache timeout changed to 6 hours * tedt reponse * changes * name change * broken link fixewd * extra `EOF` removed * low cache number to check * update to only comment on non-forked prs * cache put back to 6 hours * cache test 1 * cache check removed * cache changed to 5 minutes for test * cache 3 hours * concurrency checks added * test: trigger lychee workflow * minor text change
1 parent 3db418c commit 4afe5e1

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

β€Ž.github/workflows/lychee.ymlβ€Ž

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 🍈 Lychee
2+
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: lychee-${{ github.event.pull_request.number }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
check-links:
11+
name: Check links
12+
runs-on: ubuntu-latest
13+
permissions:
14+
pull-requests: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: 🍈 Lychee Link Checker
19+
id: lychee
20+
uses: lycheeverse/lychee-action@v2
21+
with:
22+
fail: false
23+
output: ../lychee/out.md
24+
args: >
25+
--cache
26+
--max-cache-age 3h
27+
--verbose
28+
--no-progress
29+
--accept 200,201,204,304,403,429
30+
--timeout 20
31+
--max-retries 5
32+
--retry-wait-time 5
33+
--max-concurrency 16
34+
--exclude 'http://localhost.*'
35+
--exclude 'https://localhost.*'
36+
--exclude 'https://dev.mysql.com/.*'
37+
--exclude 'https://www.mysql.com/.*'
38+
--exclude 'https://www.gnu.org/.*'
39+
--exclude 'https://www.cockroachlabs.com/.*'
40+
--exclude '^/.*'
41+
'./**/*.md' './**/*.mdx'
42+
workingDirectory: "content"
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.github_token }}
45+
46+
- name: πŸ“ Clean up Lychee Report
47+
if: ${{ always() && github.event.pull_request.head.repo.fork == false }}
48+
run: |
49+
if [ -f "lychee/out.md" ]; then
50+
# Read the original output
51+
ORIGINAL=$(cat lychee/out.md)
52+
53+
# Create formatted output
54+
cat > lychee/formatted.md << 'EOF'
55+
## 🍈 Lychee Link Check Report
56+
57+
> **Note:** Links are cached for 3 hours to avoid unnecessary requests, and speed up consecutive runs.
58+
59+
### πŸ“Š Results Overview
60+
61+
EOF
62+
63+
# Append the original content with title replacement
64+
echo "$ORIGINAL" | sed 's/^# Summary$//' | sed 's/^## Summary$//' >> lychee/formatted.md
65+
fi
66+
67+
- name: πŸ“ Comment Broken Links
68+
if: ${{ always() && github.event.pull_request.head.repo.fork == false }}
69+
uses: peter-evans/create-or-update-comment@v4
70+
with:
71+
issue-number: ${{ github.event.pull_request.number }}
72+
body-path: lychee/formatted.md
73+
74+
- name: 🚫 Fail if broken links found
75+
if: ${{ steps.lychee.outputs.exit_code != 0 }}
76+
run: exit ${{ steps.lychee.outputs.exit_code }}

0 commit comments

Comments
Β (0)