@@ -4,7 +4,8 @@ name: Tests
44# This GitHub action runs your tests for each pull request and push.
55# Optionally, you can turn it on using a schedule for regular testing.
66on :
7- pull_request :
7+ pull_request_target :
8+ types : [opened, synchronize]
89 paths-ignore :
910 - " README.md"
1011 push :
2223 runs-on : ubuntu-latest
2324 timeout-minutes : 5
2425 steps :
26+ - id : check-access
27+ if : github.event_name == 'pull_request_target'
28+ uses : actions-cool/check-user-permission@v2
29+ with :
30+ require : write
31+ username : ${{ github.triggering_actor }}
32+ - name : Check User Permission
33+ if : github.event_name == 'pull_request_target' && steps.check-access.outputs.require-result != 'false'
34+ run : |
35+ echo "User ${{ github.triggering_actor }} lacks the necessary rights on this repository."
36+ echo "Their current access level: ${{ steps.checkAccess.outputs.user-permission }}"
37+ echo "Initial trigger for this job: ${{ github.actor }}"
38+ exit 1
2539 - uses : actions/checkout@v5
40+ with :
41+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
2642 - uses : actions/setup-go@v6
2743 with :
2844 go-version-file : " go.mod"
3753 generate :
3854 runs-on : ubuntu-latest
3955 steps :
56+ - id : check-access
57+ if : github.event_name == 'pull_request_target'
58+ uses : actions-cool/check-user-permission@v2
59+ with :
60+ require : write
61+ username : ${{ github.triggering_actor }}
62+ - name : Check User Permission
63+ if : github.event_name == 'pull_request_target' && steps.check-access.outputs.require-result != 'false'
64+ run : |
65+ echo "User ${{ github.triggering_actor }} lacks the necessary rights on this repository."
66+ echo "Their current access level: ${{ steps.checkAccess.outputs.user-permission }}"
67+ echo "Initial trigger for this job: ${{ github.actor }}"
68+ exit 1
4069 - uses : actions/checkout@v5
70+ with :
71+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
4172 - uses : actions/setup-go@v6
4273 with :
4374 go-version-file : " go.mod"
6596 terraform :
6697 - " 1.13.*"
6798 steps :
99+ - id : check-access
100+ if : github.event_name == 'pull_request_target'
101+ uses : actions-cool/check-user-permission@v2
102+ with :
103+ require : write
104+ username : ${{ github.triggering_actor }}
105+ - name : Check User Permission
106+ if : github.event_name == 'pull_request_target' && steps.check-access.outputs.require-result != 'false'
107+ run : |
108+ echo "User ${{ github.triggering_actor }} lacks the necessary rights on this repository."
109+ echo "Their current access level: ${{ steps.checkAccess.outputs.user-permission }}"
110+ echo "Initial trigger for this job: ${{ github.actor }}"
111+ exit 1
68112 - uses : actions/checkout@v5
113+ with :
114+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
69115 - uses : actions/setup-go@v6
70116 with :
71117 go-version-file : " go.mod"
0 commit comments