Skip to content

Commit bfe975f

Browse files
authored
Make sure that pipeline won't be triggered by every comment (#11774)
Signed-off-by: Jakub Stejskal <xstejs24@gmail.com>
1 parent 0ec3bed commit bfe975f

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

.github/workflows/system-tests.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,8 @@ on:
2222
types: [created]
2323

2424
jobs:
25-
check-rights:
26-
runs-on: ubuntu-latest
27-
permissions:
28-
contents: write
29-
pull-requests: write
30-
checks: write
31-
steps:
32-
- uses: strimzi/strimzi-kafka-operator/.github/actions/check-permissions@main
33-
3425
# Parse and build parameters from comment or from workflow params
3526
parse-params:
36-
needs:
37-
- check-rights
3827
runs-on: ubuntu-latest
3928
permissions:
4029
contents: write
@@ -72,20 +61,35 @@ jobs:
7261
kafkaVersion: ${{ github.event.inputs.kafkaVersion }}
7362
profile: ${{ github.event.inputs.profile }}
7463
- name: Add comment
64+
if: ${{ needs.parse-params.outputs.shouldRun == 'true' }}
7565
uses: ./.github/actions/add-comment
7666
with:
7767
commentMessage: ':hourglass_flowing_sand: System test verification started: [link](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})'
7868
- name: Set check & commit status
69+
if: ${{ needs.parse-params.outputs.shouldRun == 'true' }}
7970
uses: ./.github/actions/check-and-status
8071
with:
8172
checkState: pending
8273
checkName: "System tests verification"
8374
checkDescription: "Check for overall system test verification"
8475

76+
check-rights:
77+
needs:
78+
- parse-params
79+
if: ${{ needs.parse-params.outputs.shouldRun == 'true' }}
80+
runs-on: ubuntu-latest
81+
permissions:
82+
contents: write
83+
pull-requests: write
84+
checks: write
85+
steps:
86+
- uses: strimzi/strimzi-kafka-operator/.github/actions/check-permissions@main
87+
8588
build-artifacts:
8689
name: build-artifacts
8790
needs:
8891
- parse-params
92+
- check-rights
8993
# Run only if properly triggered and the run is not for release (already built images)
9094
if: ${{ needs.parse-params.outputs.shouldRun == 'true' && needs.parse-params.outputs.releaseVersion == 'latest' }}
9195
runs-on: oracle-2cpu-8gb-arm64
@@ -103,6 +107,7 @@ jobs:
103107
name: build-images
104108
needs:
105109
- parse-params
110+
- check-rights
106111
- build-artifacts
107112
# Run only if properly triggered and the run is not for release (already built images)
108113
if: ${{ needs.parse-params.outputs.shouldRun == 'true' && needs.parse-params.outputs.releaseVersion == 'latest' && needs.build-artifacts.result != 'failure'}}
@@ -124,6 +129,7 @@ jobs:
124129
name: run-tests
125130
needs:
126131
- parse-params
132+
- check-rights
127133
- build-artifacts
128134
- build-images
129135
# Run if properly triggered and build-images job was either succeeded or skipped
@@ -147,8 +153,10 @@ jobs:
147153

148154
report:
149155
needs:
156+
- parse-params
157+
- check-rights
150158
- run-tests
151-
if: ${{ always() }}
159+
if: ${{ always() && needs.parse-params.outputs.shouldRun == 'true' }}
152160
runs-on: ubuntu-latest
153161
permissions:
154162
contents: write

0 commit comments

Comments
 (0)