Skip to content

Commit 29678df

Browse files
committed
chore: add broken-links check
1 parent f6a6b2a commit 29678df

File tree

3 files changed

+98
-2
lines changed

3 files changed

+98
-2
lines changed

.github/workflows/broken-links.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Check Broken Links in MDX Files
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'mintlify/**/*.mdx'
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
check-broken-links:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18'
24+
25+
- name: Install Mintlify CLI
26+
run: npm install -g mintlify
27+
28+
- name: Run broken links check
29+
id: broken-links
30+
working-directory: mintlify
31+
run: |
32+
echo "Running mint broken-links in mintlify directory..."
33+
34+
# Run broken links check and capture both stdout and stderr
35+
set +e # Don't exit on error
36+
mint broken-links &> broken-links-output.txt
37+
mint_exit_code=$?
38+
set -e # Re-enable exit on error
39+
40+
echo "mint_exit_code=$mint_exit_code" >> $GITHUB_OUTPUT
41+
42+
# Show original output for debugging
43+
echo "Original mint output:"
44+
cat broken-links-output.txt
45+
46+
# Always report success and pass through the raw output
47+
echo "has_broken_links=false" >> $GITHUB_OUTPUT
48+
echo "RAW_OUTPUT<<EOF" >> $GITHUB_OUTPUT
49+
cat broken-links-output.txt >> $GITHUB_OUTPUT
50+
echo "EOF" >> $GITHUB_OUTPUT
51+
52+
- name: Comment on PR
53+
uses: actions/github-script@v7
54+
with:
55+
script: |
56+
const rawOutput = `${{ steps.broken-links.outputs.RAW_OUTPUT }}`;
57+
58+
const body = `## 📝 Broken Links Check Report
59+
60+
The following is the output from the broken links check:
61+
62+
\`\`\`
63+
${rawOutput}
64+
\`\`\`
65+
66+
> **Note**: Entries under \`/api-reference/\` are likely false positives and can be ignored.`;
67+
68+
// Find existing comment
69+
const comments = await github.rest.issues.listComments({
70+
owner: context.repo.owner,
71+
repo: context.repo.repo,
72+
issue_number: context.issue.number,
73+
});
74+
75+
const existingComment = comments.data.find(comment =>
76+
comment.user.login === 'github-actions[bot]' &&
77+
comment.body.includes('Broken Links Check')
78+
);
79+
80+
if (existingComment) {
81+
// Update existing comment
82+
await github.rest.issues.updateComment({
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
comment_id: existingComment.id,
86+
body: body
87+
});
88+
} else {
89+
// Create new comment
90+
await github.rest.issues.createComment({
91+
owner: context.repo.owner,
92+
repo: context.repo.repo,
93+
issue_number: context.issue.number,
94+
body: body
95+
});
96+
}

mintlify/change-database/troubleshoot.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Troubleshoot
66

77
This happens if a migration version has already completed successfully and you are trying to apply the same version. Once the migration is successful, its version string is occupied and can't be reused. You can still retry the failed migration.
88

9-
This error is more common in GitOps flow when you try to modify an existing migration file. Refer to the [GitOps troubleshoot](/change-database/troubleshoot#duplicate-version)
9+
This error is more common in GitOps flow when you try to modify an existing migration file. Refer to the [GitOps troubleshoot](/change-database/troubleshoot1#duplicate-version)
1010
to learn the correct workflow.
1111

1212
## PostgreSQL

mintlify/snippets/install/install-upgrade.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Install and Upgrade
44

55
## ⚙️ Install and Upgrade
66

7-
- Fresh install: [/get-started/self-host/deploy-with-docker](/get-started/self-host/deploy-with-docker)
7+
- Fresh install: [/get-started/self-host/deploy-with-docker](/get-started/self-2host/deploy-with-docker)
88

99
- Upgrade: [/get-started/self-host/upgrade](/get-started/self-host/upgrade)
1010

0 commit comments

Comments
 (0)