Skip to content

Commit 0394245

Browse files
committed
chore: use lychee for links checking
1 parent 9d49e18 commit 0394245

File tree

3 files changed

+60
-7
lines changed

3 files changed

+60
-7
lines changed

.github/workflows/links.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Check external links
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: "0 3 1 * *"
8+
9+
jobs:
10+
lint:
11+
name: links-check
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
15+
16+
- name: Get Current Timestamp
17+
id: timestamp
18+
run: echo "TIMESTAMP=$(date +%s)" >> "$GITHUB_ENV"
19+
20+
- name: Restore lychee cache
21+
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
22+
with:
23+
path: .lycheecache
24+
key: "cache-lychee-${{ env.TIMESTAMP }}"
25+
restore-keys: cache-lychee-
26+
27+
- name: Link Checker
28+
uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # v1.10.0
29+
with:
30+
fail: true
31+
args: -c ./lychee-links.toml --base . --cache --max-cache-age 1d . --verbose --no-progress '*.md' './**/*.md'
32+
token: "${{ secrets.GITHUB_TOKEN }}"
33+
34+
- name: Create Issue From File
35+
if: ${{ github.event_name == 'schedule' && env.lychee_exit_code != 0 }}
36+
uses: peter-evans/create-issue-from-file@433e51abf769039ee20ba1293a088ca19d573b7f # v4
37+
with:
38+
title: Link Checker Report
39+
content-filepath: ./lychee/out.md
40+
labels: report, automated issue

.pre-commit-config.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ repos:
2828
args: ["--strict" , "--force-scope"]
2929

3030
- repo: https://github.com/shellcheck-py/shellcheck-py
31-
rev: v0.10.0.1
31+
rev: v0.10.0.1 # use tags until renovate supports sha: https://github.com/renovatebot/renovate/issues/22567
3232
hooks:
3333
- id: shellcheck
34-
35-
- repo: https://github.com/tcort/markdown-link-check
36-
rev: v3.12.1 # use tags until renovate supports sha: https://github.com/renovatebot/renovate/issues/22567
37-
hooks:
38-
- id: markdown-link-check
39-
args: [-q, -c .github/markdown-links.json]
4034
...

lychee-links.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Cache the results of Lychee if ran locally in order to minimise the chance of rate limiting
2+
cache = true
3+
# Ignore all private link (such as localhost) to avoid errors
4+
exclude_all_private = true
5+
# HTTP status code: 429 (Too Many Requests) will also be treated as a valid link if Lychee gets rate limited
6+
accept = ["200", "403"]
7+
# retry
8+
max_retries = 6
9+
retry_wait_time = 10
10+
max_concurrency = 3
11+
12+
# Exclude all unsupported versioned_docs
13+
exclude_path = [
14+
]
15+
16+
# Explicitly exclude some URLs
17+
exclude = [
18+
"^file:",
19+
]

0 commit comments

Comments
 (0)