Skip to content

Commit 0a01f03

Browse files
committed
Replace shell script with JS script
1 parent 6742599 commit 0a01f03

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/preview.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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" | (pr_preview=$(cat); echo -e "BASE_URL=/pr-preview/pr-$pr_preview/") >> $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: ${{ env.BASE_URL }}
39+
base-url: ${{ steps.base-url.outputs.result }}
3240

3341
- name: Deploy preview
3442
uses: rossjrw/pr-preview-action@v1

0 commit comments

Comments
 (0)