Skip to content

Commit 6493011

Browse files
authored
Monthly Link Check (#3280)
* Create MonthlyLinkCheck.yml * Update MonthlyLinkCheck.yml * Update MonthlyLinkCheck.yml * Update MonthlyLinkCheck.yml
1 parent 94024ab commit 6493011

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#Runs once a month and checks links in the repo to ensure they are valid
2+
#If action fails, it creates an issue with the failing links and an "incorrect link" label
3+
#If link is valid but failing, it can be added to the .lycheeignore file
4+
#Action can also be run manually as needed.
5+
6+
7+
name: Monthly Link Check
8+
on:
9+
schedule:
10+
- cron: '0 0 1 * *' # Runs at midnight on the first day of every month
11+
workflow_dispatch: # Allows manual triggering of the workflow
12+
jobs:
13+
linkChecker:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
issues: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 1
21+
- name: Check Links
22+
id: lychee
23+
uses: lycheeverse/lychee-action@v2
24+
with:
25+
args: --accept=200,403,429 --base . --verbose --no-progress './**/*.md' './**/*.html' './**/*.rst'
26+
token: ${{ secrets.CUSTOM_TOKEN }}
27+
fail: true
28+
29+
- name: Create Issue From File
30+
if: failure() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
31+
uses: peter-evans/create-issue-from-file@v5
32+
with:
33+
title: Broken links detected in docs 🔗
34+
content-filepath: ./lychee/out.md
35+
labels: 'incorrect link'
36+
#token: ${{ secrets.CUSTOM_TOKEN }}
37+
38+
39+
- name: Suggestions
40+
if: failure()
41+
run: |
42+
echo -e "\nPlease review the links reported in the Check links step above."
43+
echo -e "If a link is valid but fails due to a CAPTCHA challenge, IP blocking, login requirements, etc., consider adding such links to .lycheeignore file to bypass future checks.\n"
44+
exit 1

0 commit comments

Comments
 (0)