Skip to content

Commit 903c337

Browse files
committed
workflow: Verify links
Verifies that links within the project are alive and doesn't go to outdated or otherwise dead links. Signed-off-by: Freya Gustavsson <[email protected]>
1 parent 705b829 commit 903c337

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/verify-links.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Verify links
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- workflow/verify-links # TODO REMOVE
8+
repository_dispatch:
9+
workflow_dispatch:
10+
schedule:
11+
- cron: "08 08 * * 1"
12+
13+
jobs:
14+
linkChecker:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
issues: write # required for peter-evans/create-issue-from-file
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Restore lychee cache
22+
uses: actions/cache@v4
23+
with:
24+
path: .lycheecache
25+
key: cache-lychee-${{ github.sha }}
26+
restore-keys: cache-lychee-
27+
28+
- name: Link Checker
29+
id: lychee
30+
uses: lycheeverse/lychee-action@v2
31+
with:
32+
# Exclude all private and local addresses in the check
33+
# Also exclude domains that actively block GitHub to send requests
34+
# Any Cockpit URLs it finds that have variables will be ignored too
35+
args: |
36+
--max-concurrency 1
37+
--retry-wait-time 60
38+
--base .
39+
--skip-missing
40+
--exclude-all-private
41+
--exclude '^https://linux.die.net'
42+
--exclude 'file:///'
43+
--exclude 'domain.tld'
44+
--exclude '^.*\{\{'
45+
--exclude 'https://bodhi.fedoraproject.org/updates/cockpit-*'
46+
--cache
47+
--cache-exclude-status 400..=599
48+
--max-cache-age 1d
49+
-v
50+
.
51+
token: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Find the last open report issue
54+
if: steps.lychee.outputs.exit_code != 0
55+
id: last-issue
56+
uses: micalevisk/last-issue-action@v2
57+
with:
58+
state: open
59+
labels: link-checker
60+
61+
- name: Update or create issue report
62+
if: steps.lychee.outputs.exit_code != 0 && steps.last-issue.outputs.has-found == 'true'
63+
uses: peter-evans/create-issue-from-file@v5
64+
with:
65+
title: Link Checker Report
66+
content-filepath: ./lychee/out.md
67+
issue-number: ${{ steps.last-issue.outputs.issue-number }}
68+
labels: link-checker

0 commit comments

Comments
 (0)