Skip to content

Commit a1b6b23

Browse files
committed
fix: resolve GitHub Actions build failure
- Add fallback for package.json require in docusaurus.config.js - Copy root package.json before build step for CI compatibility - Fix working-directory override for package.json copy step Fixes build failure in GitHub Actions where parent package.json was not accessible when running from docs/ directory.
1 parent 07c0093 commit a1b6b23

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ jobs:
2929
- name: Checkout
3030
uses: actions/checkout@v4
3131

32+
- name: Copy root package.json for config reference
33+
run: cp package.json docs/package.json.root || echo "Root package.json not found, continuing..."
34+
working-directory: .
35+
3236
- name: Setup Node.js
3337
uses: actions/setup-node@v4
3438
with:
@@ -38,6 +42,7 @@ jobs:
3842

3943
- name: Install dependencies
4044
run: npm ci
45+
working-directory: docs
4146

4247
- name: Build Docusaurus site
4348
run: npm run build

docs/docusaurus.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
const packageJson = require("../package.json");
1+
// Try to load package.json from parent directory, fallback to local if not found
2+
let packageJson;
3+
try {
4+
packageJson = require("../package.json");
5+
} catch (e) {
6+
// Fallback for CI environments where parent package.json might not be accessible
7+
packageJson = { version: "0.5.0" };
8+
}
29

310
module.exports = {
411
title: "DocuMCP",

0 commit comments

Comments
 (0)