-
-
Notifications
You must be signed in to change notification settings - Fork 560
66 lines (59 loc) · 1.92 KB
/
check_links.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Check links
on:
pull_request:
branches:
- test
push:
branches:
- test
workflow_dispatch:
schedule:
- cron: '30 12 * * 1' # This will run every Monday at 12:30 UTC
jobs:
LinkChecker:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
env:
issue-lookup-label: automated-link-issue
issue-content: ./lychee-out.md
steps:
- uses: actions/checkout@v4
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
fail: true
args: --verbose --no-progress --exclude-file .lycheeignore '**/*.md' '**/*.json'
output: ${{ env.issue-content }}
# Permissions (issues: read)
- name: 'Look for an existing issue'
if: ${{ failure() }}
id: last-issue
uses: micalevisk/last-issue-action@v2
# Find the last updated open issue with a `automated-issue` label:
with:
state: open
labels: ${{ env.issue-lookup-label }}
# Permissions (issues: write)
- name: 'Create a new issue, or update an existing one'
if: ${{ failure() }}
uses: peter-evans/create-issue-from-file@v5
with:
title: 'docs: Broken links found'
content-filepath: ${{ env.issue-content }}
# Update an existing issue if one was found (issue_number),
# otherwise an empty value creates a new issue:
issue-number: ${{ steps['last-issue']['outputs']['issue-number'] }}
# Add a label(s) that `last-issue` can use to find this issue,
# and any other relevant labels for the issue itself:
labels: |
${{ env.issue-lookup-label }}
broken-link, docs