1
1
name : java_pr
2
2
3
3
on :
4
- pull_request :
4
+ pull_request_target :
5
5
types :
6
6
- opened
7
7
- synchronize
8
8
- labeled
9
9
10
+ permissions : {}
11
+
10
12
jobs :
11
13
lint-java :
12
- # when using pull_request , all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
14
+ # when using pull_request_target , all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
13
15
if :
14
16
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
15
17
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
@@ -18,15 +20,17 @@ jobs:
18
20
steps :
19
21
- uses : actions/checkout@v4
20
22
with :
21
- repository : ${{ github.event.repository.full_name }} # Uses the full repository name
22
- ref : ${{ github.ref }} # Uses the ref from the event
23
- token : ${{ secrets.GITHUB_TOKEN }} # Automatically provided token
23
+ # pull_request_target runs the workflow in the context of the base repo
24
+ # as such actions/checkout needs to be explicit configured to retrieve
25
+ # code from the PR.
26
+ ref : refs/pull/${{ github.event.pull_request.number }}/merge
24
27
submodules : recursive
28
+ persist-credentials : false
25
29
- name : Lint java
26
30
run : make lint-java
27
31
28
32
unit-test-java :
29
- # when using pull_request , all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
33
+ # when using pull_request_target , all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
30
34
if :
31
35
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
32
36
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
@@ -36,10 +40,12 @@ jobs:
36
40
steps :
37
41
- uses : actions/checkout@v4
38
42
with :
39
- repository : ${{ github.event.repository.full_name }} # Uses the full repository name
40
- ref : ${{ github.ref }} # Uses the ref from the event
41
- token : ${{ secrets.GITHUB_TOKEN }} # Automatically provided token
43
+ # pull_request_target runs the workflow in the context of the base repo
44
+ # as such actions/checkout needs to be explicit configured to retrieve
45
+ # code from the PR.
46
+ ref : refs/pull/${{ github.event.pull_request.number }}/merge
42
47
submodules : recursive
48
+ persist-credentials : false
43
49
- name : Set up JDK 11
44
50
uses : actions/setup-java@v1
45
51
with :
66
72
path : ${{ github.workspace }}/docs/coverage/java/target/site/jacoco-aggregate/
67
73
68
74
build-docker-image-java :
69
- # when using pull_request , all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
75
+ # when using pull_request_target , all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
70
76
if :
71
77
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
72
78
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
82
88
- uses : actions/checkout@v4
83
89
with :
84
90
submodules : ' true'
91
+ persist-credentials : false
85
92
- name : Setup Python
86
93
uses : actions/setup-python@v5
87
94
id : setup-python
@@ -101,7 +108,7 @@ jobs:
101
108
run : make build-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${GITHUB_SHA}
102
109
103
110
integration-test-java-pr :
104
- # when using pull_request , all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
111
+ # when using pull_request_target , all jobs MUST have this if check for 'ok-to-test' or 'approved' for security purposes.
105
112
if :
106
113
((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) ||
107
114
(github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) &&
@@ -113,11 +120,12 @@ jobs:
113
120
steps :
114
121
- uses : actions/checkout@v4
115
122
with :
116
- # pull_request runs the workflow in the context of the base repo
123
+ # pull_request_target runs the workflow in the context of the base repo
117
124
# as such actions/checkout needs to be explicit configured to retrieve
118
125
# code from the PR.
119
126
ref : refs/pull/${{ github.event.pull_request.number }}/merge
120
127
submodules : recursive
128
+ persist-credentials : false
121
129
- name : Set up JDK 11
122
130
uses : actions/setup-java@v1
123
131
with :
0 commit comments