Skip to content

Commit 7577497

Browse files
louis-preclaude
andauthored
ci: Improve link validator: check assets, merge jobs (#1087)
* Improve link validator: check asset links and merge validation jobs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix broken asset links in brand-guides Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Link visionline assets cross-section instead of copying Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 666660c commit 7577497

12 files changed

Lines changed: 33 additions & 34 deletions

File tree

.github/workflows/generate.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ jobs:
6666
commit_user_name: ${{ secrets.GIT_USER_NAME }}
6767
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
6868
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>
69-
validate-paths:
70-
name: Validate paths
69+
validate:
70+
name: Validate paths and links
7171
needs: commit
7272
runs-on: ubuntu-latest
7373
timeout-minutes: 30
@@ -80,17 +80,5 @@ jobs:
8080
uses: ./.github/actions/setup
8181
- name: Validate SUMMARY.md paths
8282
run: npm run validate-paths
83-
validate-links:
84-
name: Validate links
85-
needs: commit
86-
runs-on: ubuntu-latest
87-
timeout-minutes: 30
88-
steps:
89-
- name: Checkout
90-
uses: actions/checkout@v4
91-
with:
92-
ref: ${{ github.head_ref }}
93-
- name: Setup
94-
uses: ./.github/actions/setup
9583
- name: Validate cross-site links
9684
run: npm run validate-links

codegen/validate-links.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ const absoluteUrlPattern = new RegExp(
1919

2020
// Matches markdown links like [text](path) but not images ![text](path),
2121
// absolute URLs, anchors-only, GitBook template tags, or angle-bracket paths.
22+
// The capture group handles escaped parens \( and \) inside the link target.
2223
const relativeLinkPattern =
23-
/(?<!!)\]\((?!https?:\/\/|mailto:|#|{%|<|cursor:|file:)([^)]+)\)/g
24+
/(?<!!)\]\((?!https?:\/\/|mailto:|#|{%|<|cursor:|file:)((?:[^)\\]|\\.)+)\)/g
2425

2526
interface BrokenLink {
2627
file: string
@@ -88,9 +89,6 @@ function checkRelativeLink(file: string, line: number, rawLink: string): void {
8889
const linkPath = rawLink.replace(/ "mention"$/, '').split('#')[0]
8990
if (linkPath == null || linkPath === '') return
9091

91-
// Skip asset references
92-
if (linkPath.includes('.gitbook/assets')) return
93-
9492
// Strip GitBook markdown escapes and decode URL encoding
9593
const cleanPath = decodeURIComponent(
9694
linkPath.replaceAll('\\(', '(').replaceAll('\\)', ')').replaceAll('\\', ''),
@@ -99,6 +97,19 @@ function checkRelativeLink(file: string, line: number, rawLink: string): void {
9997
const fileDir = dirname(file)
10098
const resolved = resolve(fileDir, cleanPath)
10199

100+
// Check asset references exist
101+
if (linkPath.includes('.gitbook/assets')) {
102+
if (!existsSync(resolved)) {
103+
brokenLinks.push({
104+
file,
105+
line,
106+
url: rawLink,
107+
reason: `Asset not found: ${resolved}`,
108+
})
109+
}
110+
return
111+
}
112+
102113
// Check if target exists as file, as README.md in directory, or as directory
103114
if (!existsSync(resolved) && !existsSync(join(resolved, 'README.md'))) {
104115
brokenLinks.push({

docs/brand-guides/2n-intercom-systems/get-started-with-2n-intercoms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ echo json_encode($locks);
300300

301301
Next, you can perform the basic action of locking and unlocking the door.
302302

303-
\{% openapi src="../../.gitbook/assets/openapi.json" path="/locks/lock\_door" method="post" %\} [openapi.json](../../.gitbook/assets/openapi.json) \{% endopenapi %\}
303+
\{% openapi src="../.gitbook/assets/openapi.json" path="/locks/lock\_door" method="post" %\} [openapi.json](../.gitbook/assets/openapi.json) \{% endopenapi %\}
304304

305305
#### Unlock a door
306306

docs/brand-guides/assa-abloy-visionline-access-control-system/visionline-acs-setup-instructions/developing-and-launching-your-visionline-mobile-key-app/developing-your-visionline-mobile-key-app/step-9-create-a-production-workspace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Create a Seam production workspace to connect your Visionline account to Seam. Y
1111
1. Log in to [Seam Console](https://console.seam.co/).
1212
2. In the upper-left corner, click the workspace switcher.
1313

14-
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../.gitbook/assets/workspace-switcher.png)
14+
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../guides/.gitbook/assets/workspace-switcher.png)
1515
3. Click **New Workspace**.
1616
4. In the **Add a Workspace** dialog, type a name for your new workspace and your company name.
1717
5. Disable **Sandbox mode**.
1818

19-
![To create a production workspace, disable sandbox mode.](../../../../../.gitbook/assets/add-production-workspace.png)
19+
![To create a production workspace, disable sandbox mode.](../../../../../guides/.gitbook/assets/add-production-workspace.png)
2020
6. Click **Create Workspace**.

docs/brand-guides/assa-abloy-visionline-access-control-system/visionline-acs-setup-instructions/developing-and-launching-your-visionline-mobile-key-app/launching-your-visionline-mobile-key-app/step-8-create-a-production-workspace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ To create a production workspace.
1313
1. Log in to [Seam Console](https://console.seam.co/).
1414
2. In the upper-left corner, click the workspace switcher.
1515

16-
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../.gitbook/assets/workspace-switcher.png)
16+
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../guides/.gitbook/assets/workspace-switcher.png)
1717
3. Click **New Workspace**.
1818
4. In the **Add a Workspace** dialog, type a name for your new workspace and your company name.
1919
5. Disable **Sandbox mode**.
2020

21-
![To create a production workspace, disable sandbox mode.](../../../../../.gitbook/assets/add-production-workspace.png)
21+
![To create a production workspace, disable sandbox mode.](../../../../../guides/.gitbook/assets/add-production-workspace.png)
2222
6. Click **Create Workspace**.

docs/brand-guides/assa-abloy-visionline-access-control-system/visionline-acs-setup-instructions/developing-and-launching-your-visionline-plastic-card-encoding-app/developing-your-visionline-plastic-card-encoding-app-using-a-real-visionline-server/step-7-create-a-production-workspace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Create a Seam production workspace to connect your Visionline account to Seam. Y
1111
1. Log in to [Seam Console](https://console.seam.co/).
1212
2. In the upper-left corner, click the workspace switcher.
1313

14-
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../.gitbook/assets/workspace-switcher.png)
14+
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../guides/.gitbook/assets/workspace-switcher.png)
1515
3. Click **New Workspace**.
1616
4. In the **Add a Workspace** dialog, type a name for your new workspace and your company name.
1717
5. Disable **Sandbox mode**.
1818

19-
![To create a production workspace, disable sandbox mode.](../../../../../.gitbook/assets/add-production-workspace.png)
19+
![To create a production workspace, disable sandbox mode.](../../../../../guides/.gitbook/assets/add-production-workspace.png)
2020
6. Click **Create Workspace**.

docs/brand-guides/assa-abloy-visionline-access-control-system/visionline-acs-setup-instructions/developing-and-launching-your-visionline-plastic-card-encoding-app/developing-your-visionline-plastic-card-encoding-app-using-a-sandbox-workspace/step-1-create-a-sandbox-workspace.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The first step in developing and testing your Visionline plastic card encoding a
1111
1. Log in to [Seam Console](https://console.seam.co/).
1212
2. In the upper-left corner, click the workspace switcher.
1313

14-
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../.gitbook/assets/workspace-switcher.png)
14+
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../guides/.gitbook/assets/workspace-switcher.png)
1515
3. Click **New Workspace**.
1616
4. In the **Add a Workspace** dialog, type a name for your new workspace and your company name.
1717
5. Enable **Sandbox mode**.

docs/brand-guides/assa-abloy-visionline-access-control-system/visionline-acs-setup-instructions/developing-and-launching-your-visionline-plastic-card-encoding-app/launching-your-visionline-plastic-card-encoding-app-to-a-live-site/step-4-create-a-production-workspace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ To create a production workspace.
1313
1. Log in to [Seam Console](https://console.seam.co/).
1414
2. In the upper-left corner, click the workspace switcher.
1515

16-
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../.gitbook/assets/workspace-switcher.png)
16+
![Use the Seam Console workspace switcher to switch between workspaces and create new workspaces.](../../../../../guides/.gitbook/assets/workspace-switcher.png)
1717
3. Click **New Workspace**.
1818
4. In the **Add a Workspace** dialog, type a name for your new workspace and your company name.
1919
5. Disable **Sandbox mode**.
2020

21-
![To create a production workspace, disable sandbox mode.](../../../../../.gitbook/assets/add-production-workspace.png)
21+
![To create a production workspace, disable sandbox mode.](../../../../../guides/.gitbook/assets/add-production-workspace.png)
2222
6. Click **Create Workspace**.

docs/brand-guides/get-started-with-kwikset-wifi-locks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ puts some_lock.inspect
299299

300300
Next, you can perform the basic action of locking and unlocking the door.
301301

302-
{% openapi src="../.gitbook/assets/openapi (1).json" path="/locks/lock\_door" method="post" %} [openapi (1).json](../.gitbook/assets/openapi%20\(1\).json) {% endopenapi %}
302+
{% openapi src=".gitbook/assets/openapi (1).json" path="/locks/lock\_door" method="post" %} [openapi (1).json](.gitbook/assets/openapi%20\(1\).json) {% endopenapi %}
303303

304304
#### Unlock a door
305305

docs/brand-guides/igloohome-locks/get-started-with-igloo-locks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ echo json_encode($locks);
273273

274274
Next, you can perform the basic action of locking and unlocking a door.
275275

276-
{% openapi src="../../.gitbook/assets/openapi.json" path="/locks/lock_door" method="post" %}
277-
[openapi.json](../../.gitbook/assets/openapi.json)
276+
{% openapi src="../.gitbook/assets/openapi.json" path="/locks/lock_door" method="post" %}
277+
[openapi.json](../.gitbook/assets/openapi.json)
278278
{% endopenapi %}
279279

280280
## Unlock a door

0 commit comments

Comments
 (0)