-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
59 lines (50 loc) · 1.52 KB
/
check-links.yml
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
55
56
57
58
59
name: Check links with Lychee
on: ['push', 'pull_request', 'workflow_dispatch']
jobs:
check-links:
runs-on: ubuntu-latest
env:
LYCHEE_FILE: "lychee/out.md"
steps:
- name: Restore lychee cache
id: restore-cache
uses: actions/cache/restore@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- run: |
echo -e "$(grep -rh "More information: " pages/ | sort -u)" > links.txt
wc -l links.txt
- name: Lychee URL checker
uses: lycheeverse/lychee-action@v1
id: lychee
with:
jobSummary: false
args: >-
--cache
--verbose
--no-progress
--accept 100..=103,200..=299,429
--max-concurrency 25
--exclude-all-private
links.txt
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Sort failed URLs alphabetically
run: python3 scripts/sort-lychee-output.py
- name: Upload Lychee output as GitHub Job Summary
run: cat ${{ env.LYCHEE_FILE }} > $GITHUB_STEP_SUMMARY
- name: Save lychee cache
uses: actions/cache/save@v4
if: always()
with:
path: .lycheecache
key: ${{ steps.restore-cache.outputs.cache-primary-key }}