-
Notifications
You must be signed in to change notification settings - Fork 58
58 lines (51 loc) · 2.12 KB
/
Copy pathdocs-ci.yml
File metadata and controls
58 lines (51 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Documentation CI
on:
push:
branches: [main, dev]
paths:
- 'docs/site/**'
- '.github/workflows/docs-ci.yml'
pull_request:
branches: [main, dev]
paths:
- 'docs/site/**'
- '.github/workflows/docs-ci.yml'
jobs:
validate-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'sdk/typescript/package-lock.json'
# The examples import @trident-indexer/sdk via a file: dependency, which
# resolves to the SDK's built dist/ — and dist/ is gitignored, so without
# this step tsc fails with "Cannot find module '@trident-indexer/sdk'".
# Same reason the sdk-react job in ci.yml builds the TypeScript SDK
# before installing.
- name: Build the TypeScript SDK
working-directory: sdk/typescript
run: npm ci && npm run build
- name: Validate TypeScript Code Examples
run: |
cd docs/site
npm install --no-save typescript @trident-indexer/sdk@file:../../sdk/typescript
npx tsc --noEmit
# Only the .mdx files are checked. The previous 'docs/site/**/*.json' glob
# matched no tracked file in this repo — `git ls-files 'docs/site/**/*.json'`
# returns nothing — so in practice it only ever reached the dependency
# metadata npm unpacks into docs/site/node_modules during the step above,
# and failed the job on other people's rotted author URLs and on
# placeholder links inside TypeScript's localised diagnostic files.
#
# Remaining exclusions (unpublished product pages) live in .lycheeignore
# at the repo root, which lychee reads automatically.
- name: Check for Broken Links
uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # v1
with:
args: --verbose --no-progress 'docs/site/**/*.mdx'
fail: true