Skip to content

Commit 499e36e

Browse files
Run it Daily and create Issue
1 parent c65c5ec commit 499e36e

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed
Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
1-
name: Markdown Links Checker
1+
name: Daily Broken Link Check
22

33
on:
4-
pull_request:
5-
paths:
6-
- '**/*.md'
4+
schedule:
5+
- cron: '0 2 * * *' # Every day at 2:00 AM UTC
6+
workflow_dispatch: # Optional: allows manual run
77

88
jobs:
9-
Validate_Markdown_Links:
9+
lychee:
10+
name: Broken Link Checker
1011
runs-on: ubuntu-latest
1112

1213
steps:
13-
- name: Checkout Repository
14+
- name: Checkout code
1415
uses: actions/checkout@v4
15-
with:
16-
fetch-depth: 0 # important to allow full diff
17-
18-
- name: Get changed Markdown files
19-
id: changed-files
20-
run: |
21-
git fetch origin ${{ github.base_ref }}
22-
files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true)
23-
echo "md_files<<EOF" >> $GITHUB_OUTPUT
24-
echo "$files" >> $GITHUB_OUTPUT
25-
echo "EOF" >> $GITHUB_OUTPUT
2616

27-
- name: Run Lychee on changed Markdown files (internal links only)
28-
if: steps.changed-files.outputs.md_files != ''
17+
- name: Run Lychee link checker
18+
id: lychee
2919
uses: lycheeverse/[email protected]
3020
with:
3121
args: >
3222
--verbose
3323
--exclude-mail
3424
--no-progress
3525
--exclude ^https?://
36-
${{ steps.changed-files.outputs.md_files }}
26+
--output lychee/out.md
27+
'**/*.md'
3728
env:
3829
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Create or update GitHub Issue if broken links found
32+
if: failure() # Only runs if Lychee exits with error (broken links found)
33+
uses: peter-evans/create-issue-from-file@v4
34+
with:
35+
title: "🚨 Broken Links Detected"
36+
content-filepath: lychee/out.md
37+
labels: bug, links
38+
assignees: your-github-username # optional: assign to yourself
39+
update-existing: true # ✅ Avoids duplicate issues
40+
issue-pattern: "Broken Links Detected" # Matches existing issue title

0 commit comments

Comments
 (0)