Skip to content

Commit a13c8c8

Browse files
authored
fix: prevent unrequested PR deployments (#9049)
1 parent 7fb9197 commit a13c8c8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/pr-deploy.yaml

+10-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ jobs:
7373
CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}
7474
CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}
7575
NEW: ${{ steps.check_deployment.outputs.NEW }}
76-
BUILD: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || steps.check_deployment.outputs.NEW }}
76+
BUILD: |
77+
${{
78+
(steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) &&
79+
(
80+
(github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') ||
81+
github.event.inputs.build == 'true'
82+
)
83+
}}
7784
7885
runs-on: "ubuntu-latest"
7986
steps:
@@ -165,12 +172,12 @@ jobs:
165172
echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}"
166173
echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}"
167174
echo "NEW=${{ steps.check_deployment.outputs.NEW }}"
168-
echo "BUILD=${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || steps.check_deployment.outputs.NEW || github.event.inputs.build == 'true' }}"
175+
echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || github.event.inputs.build == 'true') }}"
169176
echo "GITHUB_REF=${{ github.ref }}"
170177
171178
comment-pr:
172179
needs: [check_pr, get_info]
173-
if: ${{ needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true' || github.event.inputs.build == 'true' }}
180+
if: needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true'
174181
runs-on: "ubuntu-latest"
175182
steps:
176183
- name: Find Comment

0 commit comments

Comments
 (0)