File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,12 @@ import {
13
13
cacheAuthorData ,
14
14
getFileCommitHashSafe ,
15
15
} from "./src/util/authorUtils" ;
16
+ import { preview , deploymentID } from "./src/util/pagesUtils" ;
16
17
17
- const preview = isCI && env . CI_ENV === "preview" ;
18
18
cacheAuthorData ( preview || env . NODE_ENV === "development" ) ;
19
19
20
- const pagesId =
21
- `${ env . GITHUB_PR_HEAD_OWNER } -${ env . GITHUB_HEAD_REF || env . GITHUB_REF_NAME } ` . substring ( 0 , 28 ) ;
22
- const url = ( preview && `https://${ pagesId } .papermc-docs.pages.dev` ) || "https://docs.papermc.io" ;
20
+ const url =
21
+ ( preview && `https://${ deploymentID } .papermc-docs.pages.dev` ) || "https://docs.papermc.io" ;
23
22
24
23
const docsCommon : Options = {
25
24
breadcrumbs : true ,
Original file line number Diff line number Diff line change
1
+ import { env } from "process" ;
2
+
3
+ export const preview = env . CI_ENV === "preview" ;
4
+
5
+ export const deploymentID : string =
6
+ `${ env . GITHUB_PR_HEAD_OWNER } -${ env . GITHUB_HEAD_REF || env . GITHUB_REF_NAME } ` // <PR head branch owner username>-<head branch name>
7
+ . substring ( 0 , 28 ) // capped to 28 characters
8
+ . toLowerCase ( ) // lowercase
9
+ . replace ( "/" , "-" ) // sanitize characters in branch names
10
+ . replace ( "_" , "-" )
11
+ . replace ( "." , "-" ) ;
You can’t perform that action at this time.
0 commit comments