Skip to content

Commit 34b8156

Browse files
committed
check for fork
Signed-off-by: Aritra Dey <[email protected]>
1 parent 4bf21cb commit 34b8156

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/workflows/publish-docs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,22 @@ jobs:
3131
uses: actions/setup-node@v4
3232
with:
3333
node-version: 20
34+
35+
- name: Calculate BASE_URL
36+
run: |
37+
REPO="${{ github.event.repository.name }}"
38+
OWNER="${{ github.repository_owner }}"
3439
40+
if [[ "$REPO" == "$OWNER.github.io" ]]; then
41+
echo "BASE_URL=/pr-preview/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV
42+
else
43+
echo "BASE_URL=/$REPO/pr-preview/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV
44+
fi
45+
3546
- name: Install and Build
3647
run: npm ci && npm run build
48+
env:
49+
BASE_URL: ${{ env.BASE_URL }}
3750

3851

3952
- name: Deploy Preview

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
tagline:
55
"Ecosystem science, policy, and management informed by the best available data and models",
66
url: "https://pecanproject.github.io",
7-
baseUrl: "/",
7+
baseUrl: process.env.BASE_URL || "/",
88
onBrokenLinks: "ignore",
99
onBrokenMarkdownLinks: "warn",
1010
favicon: "img/favicon.ico",

0 commit comments

Comments
 (0)