diff --git a/documentation/docusaurus.config.ts b/documentation/docusaurus.config.ts index b98f74efec..731079ee3b 100644 --- a/documentation/docusaurus.config.ts +++ b/documentation/docusaurus.config.ts @@ -1,6 +1,7 @@ import { themes } from 'prism-react-renderer'; import { Config } from '@docusaurus/types'; import { Options } from '@docusaurus/plugin-content-docs'; +import { env } from "process"; import { AUTHOR_FALLBACK, AuthorData, @@ -8,7 +9,7 @@ import { cacheAuthorData, getFileCommitHashSafe, } from "./src/utils/authorUtils"; - +import { preview, deploymentID } from "./src/utils/pageUtils"; cacheAuthorData(preview || env.NODE_ENV === "development"); const lightTheme = themes.vsLight; diff --git a/documentation/src/utils/pageUtils.ts b/documentation/src/utils/pageUtils.ts new file mode 100644 index 0000000000..27282f241c --- /dev/null +++ b/documentation/src/utils/pageUtils.ts @@ -0,0 +1,9 @@ +import { env } from "process"; + +export const preview = env.CI_ENV === "preview"; + +export const deploymentID: string = + `${env.GITHUB_PR_HEAD_OWNER}-${env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME}` // - + .substring(0, 28) // capped to 28 characters + .toLowerCase() // lowercase + .replaceAll(/[/_.]/g, "-"); // sanitize characters in branch names \ No newline at end of file