Skip to content

Commit 2549299

Browse files
authored
Update deploy-preview.yml (#836)
* Update deploy-preview.yml * Adding short sha to make the urls cleaner * Remove requirement for checkout
1 parent 3fde373 commit 2549299

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/deploy-preview.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,19 @@ jobs:
5555
name: dist-files
5656
path: dist
5757

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

6672
- name: Add deployment comment
6773
uses: thollander/actions-comment-pull-request@v3

0 commit comments

Comments
 (0)