Skip to content

Commit 09f31e8

Browse files
Adi-204derberg
andauthored
ci: add workflow to verify generated docs are up to date (#2096)
Co-authored-by: Adi-204 <[email protected]> Co-authored-by: Lukasz Gornicki <[email protected]>
1 parent 9afbce4 commit 09f31e8

2 files changed

Lines changed: 57 additions & 2 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Check generated docs are up to date
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, ready_for_review]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
check-docs:
12+
name: Verify generated docs are up to date
13+
runs-on: ubuntu-latest
14+
if: >
15+
!github.event.pull_request.draft && !(
16+
(github.actor == 'asyncapi-bot' && (
17+
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
18+
startsWith(github.event.pull_request.title, 'chore(release):')
19+
)) ||
20+
(github.actor == 'asyncapi-bot-eve' && (
21+
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
22+
startsWith(github.event.pull_request.title, 'chore(release):')
23+
)) ||
24+
(github.actor == 'allcontributors[bot]' &&
25+
startsWith(github.event.pull_request.title, 'docs: add')
26+
)
27+
)
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 https://github.com/actions/checkout/releases/tag/v4.2.2
31+
32+
- name: Check package-lock version
33+
# This workflow is from our own org repo and safe to reference by 'master'.
34+
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master # //NOSONAR
35+
id: lockversion
36+
with:
37+
node-version: ${{ vars.NODE_VERSION }}
38+
39+
- name: Use Node.js
40+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.2.0 https://github.com/actions/setup-node/commit/48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
41+
with:
42+
node-version: "${{ steps.lockversion.outputs.version }}"
43+
44+
- name: Install dependencies
45+
run: npm ci
46+
47+
- name: Regenerate docs
48+
run: npm run generate:assets
49+
50+
- name: Verify no doc drift
51+
run: |
52+
git diff --exit-code || {
53+
echo "::error::Generated docs are out of date. Run 'npm run generate:assets' locally and commit the result."
54+
exit 1
55+
}

apps/react-sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
"build": "tsc",
5959
"test": "cross-env NODE_OPTIONS='--max-old-space-size=4096' CI=true jest --coverage --maxWorkers=2",
6060
"test:watch": "jest --watch",
61-
"docs": "npm run docs:markdown & npm run generate:readme:toc",
62-
"docs:markdown": "./node_modules/.bin/jsdoc2md lib/index.js -f lib/**/*.js > API.md",
61+
"docs": "npm run docs:markdown && npm run generate:readme:toc",
62+
"docs:markdown": "jsdoc2md lib/index.js -f lib/**/*.js > API.md",
6363
"lint": "eslint --max-warnings 0 --config ../../.eslintrc --ignore-path ../../.eslintignore .",
6464
"lint:fix": "eslint --max-warnings 0 --config ../../.eslintrc --ignore-path ../../.eslintignore . --fix",
6565
"generate:assets": "npm run prepublishOnly && npm run docs",

0 commit comments

Comments
 (0)