Skip to content

Commit 194bc76

Browse files
authored
CLOUDP-304211: Only accept pull_request_target with safe-to-test label (#2211)
* Only accept pr target with safe-to-test And exclude the pr evertn when safe-to-test is set Signed-off-by: jose.vazquez <[email protected]> * add traces Signed-off-by: jose.vazquez <[email protected]> * Compact check * remove branch restriction * more traces * Fix contribution triggering --------- Signed-off-by: jose.vazquez <[email protected]>
1 parent 641c5d2 commit 194bc76

File tree

2 files changed

+25
-29
lines changed

2 files changed

+25
-29
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,56 +8,28 @@ on:
88
- 'main'
99
paths-ignore:
1010
- 'docs/**'
11-
pull_request:
12-
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, labeled, unlabeled]
13-
branches:
14-
- '**'
15-
paths-ignore:
16-
- 'docs/**'
1711
merge_group:
1812
workflow_dispatch:
13+
workflow_call:
1914

2015
concurrency:
2116
group: test-${{ github.head_ref || github.ref_name }}
2217
cancel-in-progress: true
2318

2419
jobs:
25-
run-tests:
26-
name: Run Tests
27-
runs-on: ubuntu-latest
28-
# Contributions do NOT run any testing by default, a label is needed to allow testing
29-
if: |
30-
github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name ||
31-
contains(github.event.pull_request.labels.*.name, 'safe-to-test') ||
32-
contains(github.event.pull_request.labels.*.name, 'cloud-tests') ||
33-
contains(github.event.pull_request.labels.*.name, 'retest')
34-
steps:
35-
- name: allowed message
36-
run: echo "Allowed to run tests"
37-
3820
lint:
39-
needs:
40-
- run-tests
4121
uses: ./.github/workflows/lint.yaml
4222

4323
validate-manifests:
44-
needs:
45-
- run-tests
4624
uses: ./.github/workflows/validate-manifests.yml
4725

4826
unit-tests:
49-
needs:
50-
- run-tests
5127
uses: ./.github/workflows/test-unit.yml
5228

5329
check-licenses:
54-
needs:
55-
- run-tests
5630
uses: ./.github/workflows/check-licenses.yml
5731

5832
cloud-tests-filter:
59-
needs:
60-
- run-tests
6133
uses: ./.github/workflows/cloud-tests-filter.yml
6234

6335
cloud-tests:

.github/workflows/trigger.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Trigger
2+
3+
on:
4+
pull_request_target:
5+
types: [labeled]
6+
paths-ignore:
7+
- 'docs/**'
8+
pull_request:
9+
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, labeled, unlabeled]
10+
branches:
11+
- '**'
12+
paths-ignore:
13+
- 'docs/**'
14+
15+
jobs:
16+
run-tests:
17+
name: Run Tests
18+
# Contributions do NOT run any testing by default, a label is needed to allow testing
19+
# Only accept either code owner's PRs from the same repo
20+
# or pull_request_target events with the safe-to-test allow flag
21+
if: |
22+
(!contains(github.event.pull_request.labels.*.name, 'safe-to-test') && github.event_name == 'pull_request') ||
23+
(contains(github.event.pull_request_target.labels.*.name, 'safe-to-test') && github.event_name == 'pull_request_target')
24+
uses: ./.github/workflows/test.yml

0 commit comments

Comments
 (0)