Skip to content

Commit 8a18ca0

Browse files
authored
Merge pull request #12019 from KATO-Hiro/#12018
chore: Migrate link checker from mlc to lychee (#12018)
2 parents 0af22dc + e3f2486 commit 8a18ca0

7 files changed

Lines changed: 94 additions & 151 deletions

File tree

.claude/rules/tools.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@
2626

2727
| Tool | Version | Role | Constraints |
2828
|---|---|---|---|
29-
| GitHub Actions || Automated link validation | Do not run link checks locally with `curl` or `wget` |
29+
| lychee | 0.x (via lychee-action) | Automated link validation (GitHub Actions) | Configuration in `lychee.toml`. Do not run link checks locally with `curl` or `wget`. Weekly scheduled scan + PR checks. |
30+
| lychee-action | v2.8.0 | GitHub Actions integration for lychee | Used in `.github/workflows/` for link checking |

.github/workflows/link_checker.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@ name: Check Markdown links with scheduled job
22

33
on:
44
schedule:
5-
# Run everyday at 12:30 AM, JST (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
6-
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
7-
- cron: "30 15 * * *"
5+
- cron: "30 15 * * 2" # Every Wednesday at 0:30 JST (Tue 15:30 UTC)
86

97
jobs:
10-
markdown-link-check:
8+
lychee:
119
runs-on: ubuntu-latest
1210
steps:
13-
- uses: actions/checkout@master
14-
- uses: gaurav-nelson/github-action-markdown-link-check@v1
15-
with:
16-
use-quiet-mode: 'yes'
17-
use-verbose-mode: 'yes'
11+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
12+
13+
- name: Restore lychee cache
14+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
15+
with:
16+
path: .lycheecache
17+
key: cache-lychee-${{ github.ref }}
18+
restore-keys: cache-lychee-
19+
20+
- uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
21+
with:
22+
args: --cache --max-cache-age 14d --quiet "docs/**/*.md" "monthly_changelog/**/*.md" "README.md" "CONTRIBUTING.md"
23+
fail: true

.github/workflows/link_checker_for_modified_files.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,33 @@ name: Check Markdown links for modified files
33
on: [pull_request]
44

55
jobs:
6-
markdown-link-check:
6+
lychee:
77
runs-on: ubuntu-latest
88
steps:
9-
- name: Check out Git repository
10-
uses: actions/checkout@v6
9+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
10+
with:
11+
fetch-depth: 0
12+
13+
- name: Get changed markdown files
14+
id: changed-files
15+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
16+
with:
17+
files: |
18+
docs/**/*.md
19+
monthly_changelog/**/*.md
20+
README.md
21+
CONTRIBUTING.md
22+
23+
- name: Restore lychee cache
24+
if: steps.changed-files.outputs.any_changed == 'true'
25+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
26+
with:
27+
path: .lycheecache
28+
key: cache-lychee-${{ github.ref }}
29+
restore-keys: cache-lychee-
1130

12-
# Workaround for `fatal: unsafe repository (REPO is owned by someone else)` issue
13-
# https://github.com/actions/checkout/issues/760
14-
# https://github.com/actions/checkout/issues/766
15-
# https://github.com/gaurav-nelson/github-action-markdown-link-check/issues/132
16-
- name: Run markdown-link-check
17-
uses: gaurav-nelson/github-action-markdown-link-check@v1
31+
- uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
32+
if: steps.changed-files.outputs.any_changed == 'true'
1833
with:
19-
use-quiet-mode: 'yes'
20-
use-verbose-mode: 'yes'
21-
check-modified-files-only: 'yes'
34+
args: --cache --max-cache-age 14d --quiet ${{ steps.changed-files.outputs.all_changed_files }}
35+
fail: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,6 @@ __pycache__/
119119

120120
# MkDocs
121121
site/
122+
123+
# Lychee cache
124+
.lycheecache

docs/contributing/references.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ title: 関連プロジェクト・参考資料
88

99
- [AtCoderでの競技プログラミングがもっと楽しくなるサイトまとめ](https://noimin.hatenablog.com/entry/2017/12/16/230900)
1010

11-
<!-- markdown-link-check-disable -->
12-
1311
- [AtCoder Wiki](https://wikiwiki.jp/procon/Atcoder)
1412

15-
<!-- markdown-link-check-enable -->
16-
1713
- [Awesome Competitive Programming](https://github.com/lnishan/awesome-competitive-programming) ![GitHub Repo stars](https://img.shields.io/github/stars/lnishan/awesome-competitive-programming?style=plastic)
1814

1915
## 参考資料
@@ -32,18 +28,14 @@ title: 関連プロジェクト・参考資料
3228

3329
### GitHub Actions
3430

35-
- [GitHub Action - Markdown link check](https://github.com/gaurav-nelson/github-action-markdown-link-check)
31+
- [lychee](https://github.com/lycheeverse/lychee) — Fast link checker (Rust)
3632

37-
- [markdown-link-check](https://github.com/tcort/markdown-link-check)
38-
39-
- [TOC Generator](https://github.com/technote-space/toc-generator)
33+
- [lychee-action](https://github.com/lycheeverse/lychee-action) — GitHub Actions integration
4034

4135
### UI
4236

4337
- [Favicon Generator - Text to Favicon - favicon.io](https://favicon.io/favicon-generator/)
4438

45-
- [How to add Emoji Prefix to commit message](https://qiita.com/Jung0/items/0a9a7a97a2c17f92d3c5)
46-
4739
- [Summary Card for Twitter](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary)
4840

4941
- [Card validator](https://cards-dev.twitter.com/validator)

lychee.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Lychee link checker configuration
2+
3+
exclude = [
4+
# Domains that return 403 / explicitly reject automated access
5+
"^https://archive\\.topcoder\\.com/",
6+
"^https://atcoder-companions\\.kakira\\.dev/",
7+
"^https://atcoder\\.jp/",
8+
"^https://beet-aizu\\.hatenablog\\.com/",
9+
"^https://cards-dev\\.twitter\\.com/",
10+
"^https://clist\\.by/",
11+
"^https://codeforces\\.com/",
12+
"^https://ctftime\\.org/",
13+
"^https://dreamhack\\.io/",
14+
"^https://github\\.com/",
15+
"^https://img\\.shields\\.io/github/stars/",
16+
"^https://kakuyomu\\.jp/",
17+
"^https://kenkoooo\\.com/atcoder/",
18+
"^https://leetcode\\.com/",
19+
"^https://medium\\.com/",
20+
"^https://oeis\\.org/",
21+
"^https://paiza\\.jp/",
22+
"^https://play\\.picoctf\\.org/",
23+
"^https://qiita\\.com/",
24+
"^https://shindanmaker\\.com/",
25+
"^https://solved\\.ac/",
26+
"^https://speakerdeck\\.com/",
27+
"^https://taksas\\.net/",
28+
"^https://twitter\\.com/",
29+
"^https://vjudge\\.net/",
30+
"^https://www\\.acmicpc\\.net/",
31+
"^https://www\\.codechef\\.com/",
32+
"^https://www\\.creativ\\.xyz/",
33+
"^https://www\\.topcoder\\.com/",
34+
"^https://x\\.com/",
35+
# Self-hosted site
36+
"^https://kato-hiro\\.github\\.io/AtCoderClans/",
37+
]
38+
39+
# Accept 429 (Rate Limited) in addition to default success codes (100–103, 200–299)
40+
# Default: 100..=103,200..=299
41+
accept = ["100..=103", "200..=299", "429"]
42+
43+
max_concurrency = 8
44+
max_retries = 0
45+
retry_wait_time = 3
46+
cache = true

mlc_config.json

Lines changed: 0 additions & 119 deletions
This file was deleted.

0 commit comments

Comments
 (0)