Repository navigation
54 lines (48 loc) · 1.79 KB
/
Copy pathlinks.yml
File metadata and controls
54 lines (48 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Links
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
linkcheck:
runs-on: ubuntu-latest
if: github.repository == 'textrefs/textrefs.org'
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
# Extract external URLs directly from sources instead of crawling the
# built site. The rendered site expands each citation system into one
# resolver URL per reference (~200k URLs for ~10 works), but every
# distinct target already appears in the YAML source. Internal links,
# anchors, and i18n are validated at build time by
# starlight-links-validator, so this workflow only checks externals.
- name: Collect external URLs from sources
run: |
mkdir -p lychee
grep -rhoE 'https?://[^"'\''<>) ]+' data/ src/content/docs/ \
| sed -E 's/[.,;:]+$//' \
| sort -u > lychee/urls.txt
echo "Collected $(wc -l < lychee/urls.txt) unique URLs"
- name: Check links with lychee
id: lychee
uses: lycheeverse/lychee-action@v2
with:
args: --config lychee.toml lychee/urls.txt
output: ./lychee/out.md
fail: false
# Report only: never fail CI. On main (or manual dispatch) open/update a
# tracking issue when broken links are found. PR runs only show the job summary.
- name: Create or update link report issue
if: >-
steps.lychee.outputs.exit_code != 0 &&
(github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch')
uses: peter-evans/create-issue-from-file@v6
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated