Skip to content

Commit 67b73b6

Browse files
authored
safe-to-test workflow: GH_TOKEN not mandatory as it was not used (#108)
1 parent c605437 commit 67b73b6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/safe-to-test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ on:
33
workflow_call:
44
secrets:
55
GH_TOKEN:
6-
required: true
6+
required: false
77

88
jobs:
99
confirm:
1010
runs-on: ubuntu-latest
11+
env:
12+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
1113
steps:
1214
- name: Checkout the repository
1315
uses: actions/checkout@v3
@@ -18,21 +20,21 @@ jobs:
1820
continue-on-error: true
1921
env:
2022
API_URL: /repos/${{ github.repository }}/collaborators/${{ github.event.pull_request.user.login }}
21-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
23+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
2224
if: github.event.label.name != 'safe to test'
2325

2426
- name: If collaborator, add the label
2527
run: gh pr edit $PR_NUMBER --add-label "safe to test"
2628
env:
27-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
29+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
2830
PR_NUMBER: ${{ github.event.number }}
2931
if: steps.authorization.outcome == 'success'
3032

3133
- name: Remove the 'safe to test', not a collaborator, PR was updated or not just added
3234
id: removed
3335
run: gh pr edit $PR_NUMBER --remove-label "safe to test"
3436
env:
35-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
37+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
3638
PR_NUMBER: ${{ github.event.number }}
3739
if: >-
3840
steps.authorization.outcome != 'success' &&
@@ -44,5 +46,5 @@ jobs:
4446
gh api -H "Accept: application/vnd.github.v3+json" $API_URL
4547
--jq .labels | grep 'safe to test'
4648
env:
47-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
49+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
4850
API_URL: /repos/${{ github.repository }}/issues/${{ github.event.number }}

0 commit comments

Comments
 (0)