Skip to content

Commit 04e081e

Browse files
committed
valid ci e2e triggers group
Signed-off-by: Mohammed Abdi <mohammed.munir.abdi@ibm.com>
1 parent 639a443 commit 04e081e

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

.github/workflows/ci-pr-checks.yaml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
name: CI - PR Checks
22

33
# Cancel previous runs on the same PR when new commits are pushed
4-
# This prevents multiple CI runs from running simultaneously for the same PR
4+
# Only group by PR number for legitimate triggers (pull_request, workflow_dispatch, /trigger-e2e-full comments)
5+
# Regular comments get a unique group (run_id) so they don't cancel in-progress test runs
6+
#
7+
# Logic:
8+
# - Regular comments (not /trigger-e2e-full): unique group prevents cancellation of real tests
9+
# - Valid triggers: group 'ci-pr-checks-{pr_number}' (can cancel previous runs for same PR)
10+
# - Fallback chain for ID: pull_request.number -> issue.number -> run_id
11+
#
12+
# NOTE: Valid command list (/trigger-e2e-full) must stay in sync with check-full-tests job validation
513
concurrency:
6-
group: ci-pr-checks-${{ github.event.pull_request.number || github.run_id }}
14+
group: >-
15+
${{
16+
github.event_name == 'issue_comment' &&
17+
!contains(github.event.comment.body, '/trigger-e2e-full')
18+
&& format('comment-isolated-{0}', github.run_id)
19+
|| format('ci-pr-checks-{0}',
20+
github.event.pull_request.number
21+
|| github.event.issue.number
22+
|| github.run_id)
23+
}}
724
cancel-in-progress: true
825

926
on:
@@ -230,11 +247,7 @@ jobs:
230247
e2e-tests:
231248
runs-on: ubuntu-latest
232249
needs: [lint-and-test, check-code-changes, check-full-tests]
233-
if: |
234-
# Always run if explicitly triggered via /trigger-e2e-full or workflow_dispatch
235-
needs.check-full-tests.outputs.run_full == 'true' ||
236-
# Otherwise, only run if PR has code changes
237-
needs.check-code-changes.outputs.has_code_changes == 'true'
250+
if: always() && (needs.check-full-tests.outputs.run_full == 'true' || (needs.check-code-changes.result == 'success' && needs.check-code-changes.outputs.has_code_changes == 'true'))
238251
timeout-minutes: 60
239252
permissions:
240253
contents: read

0 commit comments

Comments
 (0)