-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (38 loc) · 1.33 KB
/
broken-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
name: Broken links
on:
workflow_dispatch:
schedule:
- cron: "23 23 * * 0"
permissions:
issues: write
jobs:
link-checker:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- run: mv .github/.lycheeignore .lycheeignore
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
fail: false # Don't fail on broken links, create an issue instead
- name: Find already existing issue
id: find-issue
run: |
echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title \"Link Checker Report\"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}
- name: Close issue if everything is fine
if: env.lychee_exit_code == 0 && steps.find-issue.outputs.number != ''
run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }}
env:
GH_TOKEN: ${{ github.token }}
- name: Create Issue From File
if: env.lychee_exit_code != 0
uses: peter-evans/create-issue-from-file@v5
with:
issue-number: ${{ steps.find-issue.outputs.number }}
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: bug, automated