-
Notifications
You must be signed in to change notification settings - Fork 106
57 lines (49 loc) · 1.67 KB
/
broken-links-checker.yml
File metadata and controls
57 lines (49 loc) · 1.67 KB
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
47
48
49
50
51
52
53
54
55
56
57
name: Broken Link Checker
on:
pull_request:
paths:
- '**/*.md'
workflow_dispatch:
permissions:
contents: read
jobs:
markdown-link-check:
name: Check Markdown Broken Links
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v5
with:
fetch-depth: 0
# For PR : Get only changed markdown files
- name: Get changed markdown files (PR only)
id: changed-markdown-files
if: github.event_name == 'pull_request'
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v46
with:
files: |
**/*.md
# For PR: Check broken links only in changed files
- name: Check Broken Links in Changed Markdown Files
id: lychee-check-pr
if: github.event_name == 'pull_request' && steps.changed-markdown-files.outputs.any_changed == 'true'
uses: lycheeverse/lychee-action@v2.6.1
with:
args: >
--verbose --no-progress --exclude ^https?://
${{ steps.changed-markdown-files.outputs.all_changed_files }}
failIfEmpty: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# For manual trigger: Check all markdown files in repo
- name: Check Broken Links in All Markdown Files in Entire Repo (Manual Trigger)
id: lychee-check-manual
if: github.event_name == 'workflow_dispatch'
uses: lycheeverse/lychee-action@v2.6.1
with:
args: >
--verbose --no-progress --exclude ^https?://
'**/*.md'
failIfEmpty: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}