Skip to content

Commit

Permalink
Update CI to check links in guides (#2841)
Browse files Browse the repository at this point in the history
  • Loading branch information
Strift authored Jun 6, 2024
1 parent e426ed3 commit 8c4fa6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/actions/validate-docs-links/src/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ const slugger = new GithubSlugger()
async function getAllMdxFilePaths(basePath: string): Promise<RouteFragment[]> {
const sidebarLearn: ConfigSchema = JSON.parse(await fs.readFile(path.join(basePath, 'config/sidebar-learn.json'), 'utf8'))
const sidebarReference: ConfigSchema = JSON.parse(await fs.readFile(path.join(basePath, 'config/sidebar-reference.json'), 'utf8'))
const sidebarGuides: ConfigSchema = JSON.parse(await fs.readFile(path.join(basePath, 'config/sidebar-guides.json'), 'utf8'))
const footer: FooterConfigSchema = JSON.parse(await fs.readFile(path.join(basePath, 'config/sidebar-footer.json'), 'utf8'))

const config = [
...sidebarLearn.map(group => ({...group, slug: path.join('learn', group.slug)})),
...sidebarReference.map(group => ({...group, slug: path.join('reference/', group.slug)}))
...sidebarReference.map(group => ({...group, slug: path.join('reference/', group.slug)})),
...sidebarGuides.map(group => ({...group, slug: path.join('guides/', group.slug)}))
]

let allRoutes: RouteSchema[] = [{source: path.join(basePath, 'home.mdx'), slug: '', label: 'Homepage'}]
Expand Down Expand Up @@ -168,7 +170,7 @@ function validateInternalLink(errors: Errors, href: string): void {

// check if doc page exists
const foundPage = documentMap.get(link.replace(/^\/+/, ''))


if (!foundPage) {
errors.link.push(href)
Expand Down Expand Up @@ -205,7 +207,7 @@ function traverseTreeAndValidateLinks(tree: any, doc: Document, setFailed: Failu
hash: [],
source: [],
relative: [],

}

// Matches markdown links like [text](link) (excluding those that end with a file extension)
Expand Down
1 change: 1 addition & 0 deletions config/sidebar-guides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]

0 comments on commit 8c4fa6e

Please sign in to comment.