Skip to content

Commit 5100766

Browse files
CCM-8044: Only Deploy on Merge Test - Fix workflow dispatch
1 parent 6d7d169 commit 5100766

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/pr_closed.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,26 @@ concurrency:
1212
cancel-in-progress: false
1313

1414
jobs:
15-
deploy-main:
15+
check-merge-or-workflow-dispatch:
1616
runs-on: ubuntu-latest
17+
outputs:
18+
deploy: ${{ steps.check.outputs.deploy }}
19+
steps:
20+
- name: Check if PR was merged or workflow is triggered by workflow_dispatch
21+
id: check
22+
run: |
23+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
24+
echo "deploy=true" >> $GITHUB_OUTPUT
25+
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.merged }}" == "true" ]]; then
26+
echo "deploy=true" >> $GITHUB_OUTPUT
27+
else
28+
echo "deploy=false" >> $GITHUB_OUTPUT
29+
fi
30+
31+
deploy-main:
32+
needs: check-merge-or-workflow-dispatch
1733
name: Deploy changes to main in dev AWS account
18-
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == 'true'
34+
if: needs.check-merge-or-workflow-dispatch.outputs.deploy == 'true'
1935

2036
permissions:
2137
id-token: write

0 commit comments

Comments
 (0)