3
3
workflow_call :
4
4
secrets :
5
5
GH_TOKEN :
6
- required : true
6
+ required : false
7
7
8
8
jobs :
9
9
confirm :
10
10
runs-on : ubuntu-latest
11
+ env :
12
+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
11
13
steps :
12
14
- name : Checkout the repository
13
15
uses : actions/checkout@v3
@@ -18,21 +20,21 @@ jobs:
18
20
continue-on-error : true
19
21
env :
20
22
API_URL : /repos/${{ github.repository }}/collaborators/${{ github.event.pull_request.user.login }}
21
- GITHUB_TOKEN : ${{secrets .GITHUB_TOKEN}}
23
+ GITHUB_TOKEN : ${{ env .GITHUB_TOKEN }}
22
24
if : github.event.label.name != 'safe to test'
23
25
24
26
- name : If collaborator, add the label
25
27
run : gh pr edit $PR_NUMBER --add-label "safe to test"
26
28
env :
27
- GITHUB_TOKEN : ${{secrets .GITHUB_TOKEN}}
29
+ GITHUB_TOKEN : ${{ env .GITHUB_TOKEN }}
28
30
PR_NUMBER : ${{ github.event.number }}
29
31
if : steps.authorization.outcome == 'success'
30
32
31
33
- name : Remove the 'safe to test', not a collaborator, PR was updated or not just added
32
34
id : removed
33
35
run : gh pr edit $PR_NUMBER --remove-label "safe to test"
34
36
env :
35
- GITHUB_TOKEN : ${{secrets .GITHUB_TOKEN}}
37
+ GITHUB_TOKEN : ${{ env .GITHUB_TOKEN }}
36
38
PR_NUMBER : ${{ github.event.number }}
37
39
if : >-
38
40
steps.authorization.outcome != 'success' &&
44
46
gh api -H "Accept: application/vnd.github.v3+json" $API_URL
45
47
--jq .labels | grep 'safe to test'
46
48
env :
47
- GITHUB_TOKEN : ${{secrets .GITHUB_TOKEN}}
49
+ GITHUB_TOKEN : ${{ env .GITHUB_TOKEN }}
48
50
API_URL : /repos/${{ github.repository }}/issues/${{ github.event.number }}
0 commit comments