Skip to content

Commit

Permalink
Getting baseUrl from env (#2898)
Browse files Browse the repository at this point in the history
* Getting baseUrl from env

* Setting env var before build
  • Loading branch information
diemol authored Aug 21, 2024
1 parent 91fa817 commit 539a4f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/deploy-pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}

- name: Set preview path
run: echo "PREVIEW_PATH=sauce-docs/pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV"

- name: Install Dependencies
if: steps.cache-build.outputs.cache-hit != 'true' && github.event.action != 'closed' # Skip if the PR was closed
run: |
Expand Down
7 changes: 6 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
const unwrapJsx = require('./src/plugins/unwrap-jsx');

// Enabling PR previews
let siteBaseUrl = "/"
if (process.env.PREVIEW_PATH) siteBaseUrl += process.env.PREVIEW_PATH

const docusaurusConfig = {
title: 'Sauce Labs Documentation',
tagline: 'Test all the things.',
url: 'https://docs.saucelabs.com',
noIndex: process.env.NO_INDEX,
trailingSlash: true,
baseUrl: '/',
baseUrl: siteBaseUrl,
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
organizationName: 'saucelabs',
Expand Down

0 comments on commit 539a4f4

Please sign in to comment.