From f91587c04a484d111111cfc7fe363dac54eb1746 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev Date: Sat, 25 Apr 2026 14:18:52 +0300 Subject: [PATCH 1/4] 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) --- .github/workflows/build.yml | 11 +++++------ .github/workflows/deploy.yml | 11 +++++------ lychee.toml | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 lychee.toml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 832d0df..1bdca5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,9 +30,8 @@ jobs: working-directory: astro-site run: npm run build - # TODO: Fix lychee configuration for Astro's base path and fragment links (#121) - # - name: Check links - # uses: lycheeverse/lychee-action@v2 - # with: - # args: --base ${{ github.workspace }}/astro-site/dist --root-dir ${{ github.workspace }}/astro-site/dist astro-site/dist - # fail: true + - name: Check links + uses: lycheeverse/lychee-action@v2 + with: + args: --base astro-site/dist --config lychee.toml 'astro-site/dist/**/*.html' + fail: true diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0d77dc6..82ca2ae 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,12 +39,11 @@ jobs: working-directory: astro-site run: npm run build - # TODO: Fix lychee configuration for Astro's base path and fragment links (#121) - # - name: Check links - # uses: lycheeverse/lychee-action@v2 - # with: - # args: --base ${{ github.workspace }}/astro-site/dist --root-dir ${{ github.workspace }}/astro-site/dist astro-site/dist - # fail: true + - name: Check links + uses: lycheeverse/lychee-action@v2 + with: + args: --base astro-site/dist --config lychee.toml 'astro-site/dist/**/*.html' + fail: true - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 0000000..68dfd39 --- /dev/null +++ b/lychee.toml @@ -0,0 +1,23 @@ +# Lychee link checker configuration +# Runs against the Astro build output in astro-site/dist/ + +# Remap the /tutorial-git/ base path to the dist root so that +# root-relative links like /tutorial-git/introduction/ resolve +# to dist/introduction/index.html +remap = ["/tutorial-git/(.*) file:///$1"] + +# Skip external links in CI to avoid flaky failures from transient +# network issues. Run with --include-mail to check mailto: links. +exclude_path = [] + +# Exclude external URLs to keep CI fast and deterministic +exclude = [ + "^https://", + "^http://", +] + +# Accept 200 and 204 +accept = [200, 204] + +# No caching needed in CI +no_progress = true From 16f56e2896bded1246ac9c4f3a3a7eb49d5ac090 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev Date: Sat, 25 Apr 2026 14:20:10 +0300 Subject: [PATCH 2/4] fix: use --root-dir instead of --base for lychee local paths Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/build.yml | 2 +- .github/workflows/deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1bdca5c..b07a2dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,5 +33,5 @@ jobs: - name: Check links uses: lycheeverse/lychee-action@v2 with: - args: --base astro-site/dist --config lychee.toml 'astro-site/dist/**/*.html' + args: --root-dir astro-site/dist --config lychee.toml 'astro-site/dist/**/*.html' fail: true diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 82ca2ae..a9799a4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -42,7 +42,7 @@ jobs: - name: Check links uses: lycheeverse/lychee-action@v2 with: - args: --base astro-site/dist --config lychee.toml 'astro-site/dist/**/*.html' + args: --root-dir astro-site/dist --config lychee.toml 'astro-site/dist/**/*.html' fail: true - name: Upload artifact From d8e551caffca7250fe3df53e48ae6db287d55505 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev Date: Sat, 25 Apr 2026 14:22:31 +0300 Subject: [PATCH 3/4] fix: remap to root-relative paths instead of file:// URLs Co-Authored-By: Claude Opus 4.6 (1M context) --- lychee.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lychee.toml b/lychee.toml index 68dfd39..83ddf4f 100644 --- a/lychee.toml +++ b/lychee.toml @@ -4,7 +4,7 @@ # Remap the /tutorial-git/ base path to the dist root so that # root-relative links like /tutorial-git/introduction/ resolve # to dist/introduction/index.html -remap = ["/tutorial-git/(.*) file:///$1"] +remap = ["^/tutorial-git/(.*) /$1"] # Skip external links in CI to avoid flaky failures from transient # network issues. Run with --include-mail to check mailto: links. From ad8185c8587e9c655c84e698a2ecbcda91b05ee8 Mon Sep 17 00:00:00 2001 From: Branimir Georgiev Date: Sat, 25 Apr 2026 14:27:48 +0300 Subject: [PATCH 4/4] 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) --- .github/workflows/build.yml | 3 +++ .github/workflows/deploy.yml | 3 +++ lychee.toml | 10 ---------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b07a2dc..e85f420 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,9 @@ jobs: working-directory: astro-site run: npm run build + - name: Create base path symlink for link checker + run: ln -s . astro-site/dist/tutorial-git + - name: Check links uses: lycheeverse/lychee-action@v2 with: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a9799a4..7ef4de3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,6 +39,9 @@ jobs: working-directory: astro-site run: npm run build + - name: Create base path symlink for link checker + run: ln -s . astro-site/dist/tutorial-git + - name: Check links uses: lycheeverse/lychee-action@v2 with: diff --git a/lychee.toml b/lychee.toml index 83ddf4f..8f3d6c5 100644 --- a/lychee.toml +++ b/lychee.toml @@ -1,15 +1,6 @@ # Lychee link checker configuration # Runs against the Astro build output in astro-site/dist/ -# Remap the /tutorial-git/ base path to the dist root so that -# root-relative links like /tutorial-git/introduction/ resolve -# to dist/introduction/index.html -remap = ["^/tutorial-git/(.*) /$1"] - -# Skip external links in CI to avoid flaky failures from transient -# network issues. Run with --include-mail to check mailto: links. -exclude_path = [] - # Exclude external URLs to keep CI fast and deterministic exclude = [ "^https://", @@ -19,5 +10,4 @@ exclude = [ # Accept 200 and 204 accept = [200, 204] -# No caching needed in CI no_progress = true