Skip to content

Commit 539a4f4

Browse files
authored
Getting baseUrl from env (#2898)
* Getting baseUrl from env * Setting env var before build
1 parent 91fa817 commit 539a4f4

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/workflows/deploy-pr-preview.yml

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ jobs:
3939
path: |
4040
build
4141
key: ${{ runner.os }}-${{ github.sha }}
42+
43+
- name: Set preview path
44+
run: echo "PREVIEW_PATH=sauce-docs/pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV"
45+
4246
- name: Install Dependencies
4347
if: steps.cache-build.outputs.cache-hit != 'true' && github.event.action != 'closed' # Skip if the PR was closed
4448
run: |

docusaurus.config.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
const unwrapJsx = require('./src/plugins/unwrap-jsx');
2+
3+
// Enabling PR previews
4+
let siteBaseUrl = "/"
5+
if (process.env.PREVIEW_PATH) siteBaseUrl += process.env.PREVIEW_PATH
6+
27
const docusaurusConfig = {
38
title: 'Sauce Labs Documentation',
49
tagline: 'Test all the things.',
510
url: 'https://docs.saucelabs.com',
611
noIndex: process.env.NO_INDEX,
712
trailingSlash: true,
8-
baseUrl: '/',
13+
baseUrl: siteBaseUrl,
914
onBrokenLinks: 'throw',
1015
onBrokenMarkdownLinks: 'throw',
1116
organizationName: 'saucelabs',

0 commit comments

Comments
 (0)