Skip to content

Commit 3589685

Browse files
committed
Add ci workflow to check links
1 parent baffc8c commit 3589685

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

.github/lychee.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include_fragments = true
2+
3+
accept = ["200..=299", "429"]
4+
5+
exclude = [
6+
"^http(s)?://localhost",
7+
"^http(s)?://example.com"
8+
]

.github/workflows/check-links.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: check-links
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
merge_group:
7+
types: [checks_requested]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref_name }}
11+
cancel-in-progress: true
12+
13+
permissions: read-all
14+
15+
jobs:
16+
changedfiles:
17+
name: changed files
18+
runs-on: ubuntu-latest
19+
env:
20+
PR_HEAD: ${{ github.event.pull_request.head.sha }}
21+
outputs:
22+
files: ${{ steps.changes.outputs.files }}
23+
steps:
24+
- name: Checkout Repo
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
fetch-depth: 0
28+
- name: Get changed files
29+
id: changes
30+
run: |
31+
files=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD | grep .md$ | xargs)
32+
echo "files=$files" >> $GITHUB_OUTPUT
33+
check-links:
34+
runs-on: ubuntu-latest
35+
needs: changedfiles
36+
if: ${{needs.changedfiles.outputs.files}}
37+
steps:
38+
- name: Checkout Repo
39+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Link Checker
44+
id: lychee
45+
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
46+
with:
47+
args: "--verbose --no-progress ${{needs.changedfiles.outputs.files}} --config .github/lychee.toml"
48+
failIfEmpty: false

0 commit comments

Comments
 (0)