Skip to content

Commit 557e451

Browse files
added broken-links-checker.yml file in workflow folder
1 parent bc7b1f7 commit 557e451

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Broken Link Checker
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/*.md'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
markdown-link-check:
14+
name: Check Markdown Broken Links
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout Repo
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
# For PR : Get only changed markdown files
24+
- name: Get changed markdown files (PR only)
25+
id: changed-markdown-files
26+
if: github.event_name == 'pull_request'
27+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46
28+
with:
29+
files: |
30+
**/*.md
31+
32+
33+
# For PR: Check broken links only in changed files
34+
- name: Check Broken Links in Changed Markdown Files
35+
id: lychee-check-pr
36+
if: github.event_name == 'pull_request' && steps.changed-markdown-files.outputs.any_changed == 'true'
37+
uses: lycheeverse/[email protected]
38+
with:
39+
args: >
40+
--verbose --exclude-mail --no-progress --exclude ^https?://
41+
${{ steps.changed-markdown-files.outputs.all_changed_files }}
42+
failIfEmpty: false
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
# For manual trigger: Check all markdown files in repo
47+
- name: Check Broken Links in All Markdown Files in Entire Repo (Manual Trigger)
48+
id: lychee-check-manual
49+
if: github.event_name == 'workflow_dispatch'
50+
uses: lycheeverse/[email protected]
51+
with:
52+
args: >
53+
--verbose --exclude-mail --no-progress --exclude ^https?://
54+
'**/*.md'
55+
failIfEmpty: false
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)