File tree Expand file tree Collapse file tree 1 file changed +32
-3
lines changed Expand file tree Collapse file tree 1 file changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,44 @@ name: Integration tests
2
2
3
3
on :
4
4
push :
5
- branches :
6
- - master
5
+ branches : [master]
6
+ pull_request_target :
7
+ branches : [master]
8
+ types : [opened, synchronize, reopened]
7
9
8
10
jobs :
11
+ decide-if-trusted :
12
+ runs-on : ubuntu-latest
13
+ outputs :
14
+ ok : ${{ steps.check.outputs.ok }}
15
+ steps :
16
+ - name : Trust gate
17
+ id : check
18
+ run : |
19
+ # default to skip
20
+ echo "ok=false" >> "$GITHUB_OUTPUT"
21
+
22
+ # Push events are always safe
23
+ if [ "${{ github.event_name }}" = "push" ]; then
24
+ echo "ok=true" >> "$GITHUB_OUTPUT"
25
+ exit 0
26
+ fi
27
+
28
+ # For PRs, look at the author's relationship
29
+ case "${{ github.event.pull_request.author_association }}" in
30
+ OWNER|MEMBER|COLLABORATOR|CONTRIBUTOR)
31
+ echo "ok=true" >> "$GITHUB_OUTPUT"
32
+ ;;
33
+ esac
34
+
9
35
integration_tests :
10
- name : Run integration tests
36
+ needs : decide-if-trusted
37
+ if : needs.decide-if-trusted.outputs.ok == 'true'
11
38
runs-on : ubuntu-latest
12
39
steps :
13
40
- uses : actions/checkout@v4
41
+ with :
42
+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
14
43
- name : Setup Go
15
44
uses : actions/setup-go@v5
16
45
with :
You can’t perform that action at this time.
0 commit comments