Skip to content

Commit 00c48aa

Browse files
committed
ci: fix preview pr bad sha short
1 parent 638ba5d commit 00c48aa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/workflows/pr-preview.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ jobs:
4444
submodules: "recursive"
4545
ref: ${{ github.event.pull_request.head.ref }}
4646
repository: ${{ github.event.pull_request.head.repo.full_name }}
47-
- name: Declare some variables
48-
shell: bash
49-
run: |
50-
echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
5147

5248
- name: Create comment
5349
id: comment
@@ -75,7 +71,12 @@ jobs:
7571
with:
7672
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
7773
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
78-
command: pages deploy ./dist --project-name=rustmap --branch="${{ env.BRANCH_NAME }}"
74+
command: pages deploy ./dist --project-name=rustmap --branch "${{ env.BRANCH_NAME }}"
75+
76+
- name: Extract hash from CF url Deploy
77+
run: |
78+
url_hash=$(echo "${{ steps.deploy.outputs.deployment-url }}" | sed -n 's|https://\([^.]*\).rustmap.*|\1|p')
79+
echo "SHA_SHORT=$url_hash" >> $GITHUB_ENV
7980
8081
- name: Create comment
8182
uses: peter-evans/create-or-update-comment@v4

0 commit comments

Comments
 (0)