Skip to content

Commit 22d1ccc

Browse files
committed
Exit from deploy preview workflow when PR closed
1 parent de46e13 commit 22d1ccc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

.github/workflows/deploy-preview.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ jobs:
2828
name: Debug inputs
2929
runs-on: ubuntu-latest
3030
steps:
31-
- run: jq . <<< '${{ toJSON(github.event.inputs) }}'
31+
- name: Debug inputs
32+
run: jq . <<< '${{ toJSON(github.event.inputs) }}'
3233

3334
notify:
3435
name: Notify about deployment
@@ -44,6 +45,8 @@ jobs:
4445
DEPLOY: ${{ github.event.inputs.deploy_id }}
4546
run: |
4647
ref=$(gh pr view $ISSUE --json potentialMergeCommit -q .potentialMergeCommit.oid)
48+
[ -z "$ref" ] && { echo "No merge commit for PR $ISSUE"; exit; }
49+
4750
env=staging-$ISSUE
4851
url=https://$env.cmbuckley.co.uk
4952
echo "url=$url" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)