Skip to content

Commit 9d2eb86

Browse files
authored
Link Check just for files in a PR (#471)
* Adding a link check that works just on the files in a given PR * Modify the global link check to run weekly only * Upgrade to newer version of GHA tj-actions/changed-files
1 parent 931a73d commit 9d2eb86

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This link check is run on all PRs but just for the files that were changed/added in the PR itself.
2+
# Otherwise we had it too often that PR authors would see a failing link check that had nothing to do with their PR.
3+
4+
name: Link Check PR
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
branches:
12+
- main
13+
14+
jobs:
15+
linkChecker:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Get changed files
23+
id: changed-files
24+
uses: tj-actions/changed-files@v32
25+
26+
- name: Filter markdown files only
27+
run: |
28+
md_files=`find ${{ steps.changed-files.outputs.all_changed_files }} -maxdepth 0 -name "*.md"`
29+
echo "MARKDOWN_FILES=$md_files" >> $GITHUB_ENV
30+
31+
- name: Restore lychee cache
32+
uses: actions/cache@v3
33+
with:
34+
path: .lycheecache
35+
key: cache-lychee-${{ github.sha }}
36+
restore-keys: cache-lychee-
37+
38+
- if: ${{ env.MARKDOWN_FILES != '' }}
39+
name: Link Checker
40+
uses: lycheeverse/[email protected]
41+
with:
42+
args: --verbose --no-progress --cache --max-cache-age 1d $MARKDOWN_FILES
43+
fail: true
44+
jobSummary: true
45+
env:
46+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/link-checker.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1+
# This link check is run on all content files once per day.
2+
13
# from: https://github.com/lycheeverse/lychee-action
24
# link checker used is 'lychee': https://github.com/lycheeverse/lychee
35

46
name: Link Check
57

68
on:
7-
push:
8-
branches:
9-
- "main"
10-
pull_request:
119
schedule:
1210
# * is a special character in YAML so you have to quote this string
13-
- cron: '30 8 * * *'
11+
- cron: '30 8 * * 5'
1412

1513
jobs:
1614
linkChecker:
@@ -32,4 +30,4 @@ jobs:
3230
fail: true
3331
jobSummary: true
3432
env:
35-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
33+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

TRUSTED-COMMITTERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ However, please channel working group-specific requests through the trusted comm
5757

5858
## References
5959

60-
* Our trusted committer process was inspired by [this](https://tech.europace.de/voting-in-new-trusted-committers/).
60+
Our trusted committer process was inspired by [this](https://tech.europace.de/voting-in-new-trusted-committers/).

0 commit comments

Comments
 (0)