Skip to content

Commit 2901ab5

Browse files
committed
Add CI check for broken links
1 parent eadb99c commit 2901ab5

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

.github/workflows/broken-links.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Check for Broken Links
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
# Allow manual trigger
11+
workflow_dispatch:
12+
13+
jobs:
14+
check-links:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: "20"
25+
26+
- name: Install Mintlify CLI
27+
run: npm install -g mint
28+
29+
- name: Check for broken links
30+
run: mint broken-links
31+
continue-on-error: false
32+
33+
- name: Comment on PR (if failed)
34+
if: failure() && github.event_name == 'pull_request'
35+
uses: actions/github-script@v7
36+
with:
37+
script: |
38+
github.rest.issues.createComment({
39+
issue_number: context.issue.number,
40+
owner: context.repo.owner,
41+
repo: context.repo.repo,
42+
body: '❌ **Broken links detected!**\n\nPlease check the workflow logs for details on which links are broken and fix them before merging.'
43+
})

0 commit comments

Comments
 (0)