Skip to content

Commit f78ced7

Browse files
Update link-check.yml
1 parent 224b557 commit f78ced7

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

.github/workflows/link-check.yml

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,48 @@ name: Link Check
33
on:
44
push:
55
pull_request:
6+
schedule:
7+
- cron: "0 6 * * *" # every day at 06:00 UTC
68
workflow_dispatch:
79

10+
permissions:
11+
contents: write
12+
813
jobs:
914
lychee:
10-
name: Check links with lychee
15+
name: Check links and update README
1116
runs-on: ubuntu-latest
17+
1218
steps:
1319
- name: Checkout repo
1420
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
1523

16-
- name: Run lychee (broken-link checker)
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
29+
- name: Run lychee
1730
uses: lycheeverse/[email protected]
1831
with:
19-
args: >-
20-
--no-progress
21-
--verbose
22-
--max-redirects 10
23-
--accept 200,206,301,302,303,307,308
24-
--exclude-mail
25-
--exclude-all-private
26-
--retry-wait-time 2
27-
--retry-count 2
28-
--timeout 20
29-
.
32+
args: --config .lychee.toml --no-progress
3033
env:
3134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3235

33-
- name: Upload lychee report
34-
if: always()
35-
uses: actions/upload-artifact@v4
36-
with:
37-
name: lychee-report
38-
path: lychee/out.md
36+
- name: Update Link Health section in README
37+
run: |
38+
node scripts/update-link-health.mjs
39+
40+
- name: Commit changes (if any)
41+
run: |
42+
if [[ -n "$(git status --porcelain)" ]]; then
43+
git config user.name "github-actions[bot]"
44+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
45+
git add README.md
46+
git commit -m "chore: update Link Health section (automated)"
47+
git push
48+
else
49+
echo "No README changes to commit."
50+
fi

0 commit comments

Comments
 (0)