Skip to content

Commit 42a0352

Browse files
committed
fix: ignore draft docs in link checker
1 parent 1c3827e commit 42a0352

8 files changed

Lines changed: 134 additions & 4 deletions

File tree

.github/workflows/validate-docs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,19 @@ jobs:
3030
token: ${{ secrets.GITHUB_TOKEN }}
3131
fetch-depth: 0
3232

33+
- name: Setup pnpm
34+
uses: pnpm/action-setup@v4
35+
with:
36+
version: 10.33.0
37+
3338
- name: Setup Node.js
3439
uses: actions/setup-node@v4
3540
with:
3641
node-version: '18'
42+
cache: 'pnpm'
43+
44+
- name: Install Node dependencies
45+
run: pnpm install --frozen-lockfile
3746

3847
- name: Post initial status comment
3948
id: initial-comment

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*.iws
77
.idea_modules/
88
out/
9+
node_modules/
910
images/.DS_Store
1011
.DS_Store
1112
.env/

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
save-exact=true
2+
min-release-age=3

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "mintlify-docs",
3+
"version": "1.0.0",
4+
"description": "Lightdash documentation",
5+
"private": true,
6+
"packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319",
7+
"scripts": {},
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/lightdash/mintlify-docs.git"
11+
},
12+
"type": "commonjs",
13+
"dependencies": {
14+
"gray-matter": "^4.0.3"
15+
}
16+
}

pnpm-lock.yaml

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
minimumReleaseAge: 4320

scripts/check-links.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
const fs = require('fs');
1010
const path = require('path');
11+
const matter = require('gray-matter');
1112

1213
const CHECK_EXTERNAL = process.argv.includes('--external');
1314

@@ -41,6 +42,11 @@ function findMDXFiles(dir, fileList = []) {
4142
return fileList;
4243
}
4344

45+
function hasDraftTitle(content) {
46+
const title = matter(content).data.title;
47+
return typeof title === 'string' && title.toLowerCase().includes('draft');
48+
}
49+
4450
function extractLinks(content, filePath) {
4551
const links = [];
4652

@@ -282,9 +288,13 @@ async function main() {
282288

283289
const mdxFiles = findMDXFiles('.');
284290
const excludedPaths = ['node_modules', '.git', 'CONTRIBUTING.md'];
285-
const filteredFiles = mdxFiles.filter(file =>
286-
!excludedPaths.some(excluded => file.includes(excluded))
287-
);
291+
const filteredFiles = mdxFiles.filter(file => {
292+
if (excludedPaths.some(excluded => file.includes(excluded))) {
293+
return false;
294+
}
295+
296+
return !hasDraftTitle(fs.readFileSync(file, 'utf8'));
297+
});
288298

289299
const brokenLinks = [];
290300
const externalLinks = [];

timezones-draft.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Working with timezones in Lightdash"
2+
title: "Draft: Working with timezones in Lightdash"
33
description: "Hidden draft: how to model warehouse data and use Lightdash so that timezones behave predictably."
44
hidden: true
55
---

0 commit comments

Comments
 (0)