Skip to content

Commit 5d60ca4

Browse files
brabojclaude
andauthored
fix: configure lychee link checker for Astro base path (#125)
* fix: configure lychee link checker for Astro base path (#121) Add lychee.toml with remap rule to strip /tutorial-git/ prefix, re-enable link checking in both build and deploy workflows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use --root-dir instead of --base for lychee local paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remap to root-relative paths instead of file:// URLs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use symlink to mirror Astro base path for lychee Create dist/tutorial-git -> dist/ symlink so root-relative links like /tutorial-git/introduction/ resolve correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d78535d commit 5d60ca4

3 files changed

Lines changed: 29 additions & 12 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ jobs:
3030
working-directory: astro-site
3131
run: npm run build
3232

33-
# TODO: Fix lychee configuration for Astro's base path and fragment links (#121)
34-
# - name: Check links
35-
# uses: lycheeverse/lychee-action@v2
36-
# with:
37-
# args: --base ${{ github.workspace }}/astro-site/dist --root-dir ${{ github.workspace }}/astro-site/dist astro-site/dist
38-
# fail: true
33+
- name: Create base path symlink for link checker
34+
run: ln -s . astro-site/dist/tutorial-git
35+
36+
- name: Check links
37+
uses: lycheeverse/lychee-action@v2
38+
with:
39+
args: --root-dir astro-site/dist --config lychee.toml 'astro-site/dist/**/*.html'
40+
fail: true

.github/workflows/deploy.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ jobs:
3939
working-directory: astro-site
4040
run: npm run build
4141

42-
# TODO: Fix lychee configuration for Astro's base path and fragment links (#121)
43-
# - name: Check links
44-
# uses: lycheeverse/lychee-action@v2
45-
# with:
46-
# args: --base ${{ github.workspace }}/astro-site/dist --root-dir ${{ github.workspace }}/astro-site/dist astro-site/dist
47-
# fail: true
42+
- name: Create base path symlink for link checker
43+
run: ln -s . astro-site/dist/tutorial-git
44+
45+
- name: Check links
46+
uses: lycheeverse/lychee-action@v2
47+
with:
48+
args: --root-dir astro-site/dist --config lychee.toml 'astro-site/dist/**/*.html'
49+
fail: true
4850

4951
- name: Upload artifact
5052
uses: actions/upload-pages-artifact@v3

lychee.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Lychee link checker configuration
2+
# Runs against the Astro build output in astro-site/dist/
3+
4+
# Exclude external URLs to keep CI fast and deterministic
5+
exclude = [
6+
"^https://",
7+
"^http://",
8+
]
9+
10+
# Accept 200 and 204
11+
accept = [200, 204]
12+
13+
no_progress = true

0 commit comments

Comments
 (0)