Skip to content

Commit 2c79ee8

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 2c79ee8

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/verify-links.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
fail: false
33+
# Exclude all private and local addresses in the check
34+
# Also exclude domains that actively block GitHub to send requests
35+
# Any Cockpit URLs it finds that have variables will be ignored too
36+
args: |
37+
--max-concurrency 1
38+
--retry-wait-time 60
39+
--base .
40+
--skip-missing
41+
--exclude-all-private
42+
--exclude '^https://linux.die.net'
43+
--exclude 'file:///'
44+
--exclude 'domain.tld'
45+
--exclude '^.*\{\{'
46+
--exclude 'https://bodhi.fedoraproject.org/updates/cockpit-*'
47+
--cache
48+
--cache-exclude-status 400..=599
49+
--max-cache-age 1d
50+
-v
51+
.
52+
token: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Find the last open report issue
55+
if: steps.lychee.outputs.exit_code != 0
56+
id: last-issue
57+
uses: micalevisk/last-issue-action@v2
58+
with:
59+
state: open
60+
labels: link-checker
61+
62+
- name: Update or create issue report
63+
if: steps.lychee.outputs.exit_code != 0 && steps.last-issue.outputs.has-found == 'true'
64+
uses: peter-evans/create-issue-from-file@v5
65+
with:
66+
title: Link Checker Report
67+
content-filepath: ./lychee/out.md
68+
issue-number: ${{ steps.last-issue.outputs.issue-number }}
69+
labels: link-checker

0 commit comments

Comments
 (0)