Skip to content

Commit b6cf283

Browse files
author
liukangtian
committed
feat: Inject BRANCH_NAME into environment
1 parent 4313659 commit b6cf283

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/gh-pages.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
with:
2020
node-version: '20.14'
2121

22+
# Inject BRANCH_NAME into environment variables
23+
- name: Set BRANCH_NAME
24+
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
2225

2326
# Navigate to the correct working directory and install dependencies
2427
- name: Install dependencies

docusaurus.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
require('dotenv').config();
21
const { themes } = require('prism-react-renderer');
32
const { languageTabs } = require('./static/languageTabs.mjs');
4-
const isDev = process.env.NODE_ENV === 'development';
3+
const BRANCH_NAME = process.env.BRANCH_NAME;
4+
const ALGOLIA_INDEX_NAME = BRANCH_NAME === 'main' ? 'doc_babylonlabs_io' : 'doc_dev_babylonlabs_io';
55
const code_themes = {
66
light: themes.github,
77
dark: themes.dracula,
@@ -290,7 +290,7 @@ const config = {
290290
algolia: {
291291
appId: process.env.ALGOLIA_APP_ID,
292292
apiKey: process.env.ALGOLIA_API_KEY,
293-
indexName: isDev ? 'doc_dev_babylonlabs_io' : 'doc_babylonlabs_io',
293+
indexName: ALGOLIA_INDEX_NAME,
294294
contextualSearch: true,
295295
searchParameters: {},
296296
contextualSearchFilters: [],

0 commit comments

Comments
 (0)