Skip to content

Commit 36fd8f5

Browse files
authored
Update deploy-preview.yml for short sha (#4475)
* Update deploy-preview.yml for short sha * Fixing to use pages-deployment-alias-url
1 parent 16c3b2e commit 36fd8f5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/deploy-preview.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,25 @@ jobs:
5454
name: dist-files
5555
path: src/dist
5656

57+
- name: Set short git commit SHA
58+
id: vars
59+
run: |
60+
calculatedSha=$(echo ${{ github.event.pull_request.head.sha }} | head -c 8)
61+
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
62+
5763
- name: Deploy to Cloudflare
5864
id: deploy
5965
uses: cloudflare/wrangler-action@v3
6066
with:
6167
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
6268
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
63-
command: pages deploy src/dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch ${{ github.head_ref }} --commit-dirty=true
69+
command: pages deploy src/dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch=${{ env.COMMIT_SHORT_SHA }} --commit-dirty=true
6470

6571
- name: Add deployment comment
6672
uses: thollander/actions-comment-pull-request@v3
6773
with:
6874
message: |
69-
Preview URL: ${{ steps.deploy.outputs.deployment-url }}
75+
Preview URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }}
7076
reactions: eyes, rocket
7177
comment-tag: 'Preview URL'
7278
mode: recreate

0 commit comments

Comments
 (0)