File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,12 +23,20 @@ jobs:
2323 uses : ./.github/actions/execute-notebooks
2424
2525 - name : Make BASE_URL
26- run : echo ${{ github.ref }} | sed "s/[^0-9]//g" | (v=$(cat); echo -e "BASE_URL=/pr-preview/pr-$v/" ) >> $GITHUB_ENV
26+ uses : actions/github-script@v6
27+ id : base-url
28+ with :
29+ script : |
30+ const refName = "${{ github.ref_name }}"; // PR_NUMBER/merge
31+ const prNumber = refName.slice(0, refName.length - 6);
32+ const baseUrl = `/pr-preview/pr-${prNumber}/`;
33+ return baseUrl;
34+ result-encoding : string
2735
2836 - name : Build
2937 uses : ./.github/actions/build
3038 with :
31- base-url : $BASE_URL
39+ base-url : ${{ steps.base-url.outputs.result }}
3240
3341 - name : Deploy preview
3442 uses : rossjrw/pr-preview-action@v1
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ const config = {
1313 title : "Introduction to Algorithms" ,
1414 // tagline: '',
1515 url : "https://sikepuri-algorithm.github.io" ,
16- baseUrl : process . env . NODE_ENV ? "/" : process . env . BASE_URL ,
16+ baseUrl : process . env . NODE_ENV === "development" ? "/" : process . env . BASE_URL ,
1717 onBrokenLinks : "throw" ,
1818 onBrokenMarkdownLinks : "warn" ,
1919 favicon : "img/favicon.ico" ,
You can’t perform that action at this time.
0 commit comments