Skip to content

Commit 7b5cf27

Browse files
committed
feat(ci): add lychee broken link checker and stage-and-check job
Signed-off-by: skjnldsv <skjnldsv@protonmail.com> Co-authored-by: skjnldsv <14975046+skjnldsv@users.noreply.github.com>
1 parent a77bb31 commit 7b5cf27

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

‎.github/workflows/sphinxbuild.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,50 @@ jobs:
304304
echo "Staged artifacts for ${branch}:"
305305
find stage -type f | head -20
306306
307+
# ========================================================================
308+
# VALIDATION: CHECK FOR BROKEN LINKS (NEW CONTENT IN FULL CONTEXT)
309+
# ========================================================================
310+
# For link validation, we need the full context (existing versions) so
311+
# lychee can resolve cross-version references. So we:
312+
# 1. Build a temporary validation structure with both old and new content
313+
# 2. Run lychee only against the NEW content
314+
# 3. Clean up the temporary structure
315+
# ========================================================================
316+
- name: Build full validation context
317+
run: |
318+
branch="${{ steps.branch.outputs.branch_name }}"
319+
320+
# Build validation structure: start with existing versions
321+
mkdir -p full-context/server
322+
cp -r validation-context/server/* full-context/server/ || true
323+
324+
# Merge in the new artifacts
325+
mkdir -p "full-context/server/${branch}"
326+
cp -r "stage/${branch}/"* "full-context/server/${branch}/" || true
327+
328+
echo "Validation structure ready:"
329+
find full-context -type d -maxdepth 2
330+
331+
- name: Check for broken links with lychee
332+
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
333+
with:
334+
fail: true
335+
token: ${{ secrets.GITHUB_TOKEN }}
336+
jobSummary: true
337+
args: |
338+
--root-dir $(pwd)/full-context
339+
--offline
340+
--no-progress
341+
--remap 'https://docs.nextcloud.com/server/ file://$(pwd)/full-context/server/'
342+
--exclude 'mailto:'
343+
--exclude '(https?:/?/?)?$'
344+
--exclude-path '.*/404\.html'
345+
'full-context/server/${{ steps.branch.outputs.branch_name }}/**/*.html'
346+
347+
- name: Clean up validation context
348+
if: always()
349+
run: rm -rf full-context
350+
307351
# ========================================================================
308352
# UPLOAD STAGING ARTIFACTS
309353
# ========================================================================

0 commit comments

Comments
 (0)