Skip to content

Commit 0c0f9f1

Browse files
committed
Add search and report for broken links
1 parent 209777d commit 0c0f9f1

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.github/labels.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
description: "This doesn't seem right"
2424
color: '#e4e669'
2525
# Custom
26+
- name: automated
27+
description: Created by a 🤖
28+
color: '#000000'
2629
- name: "can't reproduce"
2730
color: '#e95f2c'
2831
- name: customer-requested
29-
description: was requested by a customer of us
32+
description: Was requested by a customer of us
3033
color: '#068374'
3134
- name: stale
3235
color: '#ededed'

.github/workflows/broken-links.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Broken links
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "23 23 * * 0"
7+
8+
permissions:
9+
issues: write
10+
11+
jobs:
12+
link-checker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Link Checker
18+
id: lychee
19+
uses: lycheeverse/lychee-action@v1
20+
21+
- name: Find already existing issue
22+
id: find-issue
23+
run: |
24+
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
25+
env:
26+
GH_TOKEN: ${{ github.token }}
27+
28+
- name: Close issue if everything is fine
29+
if: env.lychee_exit_code == 0 && steps.find-issue.outputs.number != ''
30+
run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }}
31+
env:
32+
GH_TOKEN: ${{ github.token }}
33+
34+
- name: Create Issue From File
35+
if: env.lychee_exit_code != 0
36+
uses: peter-evans/create-issue-from-file@v5
37+
with:
38+
issue-number: ${{ steps.find-issue.outputs.number }}
39+
title: Link Checker Report
40+
content-filepath: ./lychee/out.md
41+
labels: bug, automated

0 commit comments

Comments
 (0)