Skip to content

Commit 29322a6

Browse files
committed
add a job to build & upload the docmodel
1 parent 511b4f3 commit 29322a6

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.github/workflows/docmodel.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Generate Documentation Model
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
docmodel:
8+
name: Generate Documentation Model
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repo
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: ">=23.6.0"
18+
19+
- name: Install dependencies (with cache)
20+
uses: bahmutov/npm-install@v1
21+
22+
- name: Generate documentation model
23+
run: npm run docmodel
24+
25+
- name: Upload documentation model artifact
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: client-api-documentation
29+
path: docs/public/client.api.json
30+
retention-days: 30

config/apiExtractor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ try {
8585
);
8686

8787
await buildReport("@apollo/client", entryPointFile, "docModel");
88+
if (process.exitCode === 50) {
89+
process.exitCode = 0; // if there were only warnings, we still want to exit with 0
90+
}
8891
}
8992

9093
if (parsed.values.generate?.includes("apiReport")) {
@@ -164,6 +167,7 @@ async function buildReport(
164167
if (extractorResult.succeeded) {
165168
console.log(`✅ API Extractor completed successfully`);
166169
} else {
170+
process.exitCode = extractorResult.errorCount === 0 ? 50 : 1;
167171
console.error(
168172
`❗ API Extractor completed with ${extractorResult.errorCount} errors` +
169173
` and ${extractorResult.warningCount} warnings`
@@ -180,6 +184,5 @@ async function buildReport(
180184
}
181185
);
182186
}
183-
process.exitCode = 1;
184187
}
185188
}

0 commit comments

Comments
 (0)