@@ -29,6 +29,8 @@ permissions: read-all
29
29
30
30
jobs :
31
31
units :
32
+ # run job on proper workflow event triggers (skip job for pull_request event from forks and only run pull_request_target for "tests: run" label)
33
+ if : " ${{ (github.event.action != 'labeled' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) || github.event.label.name == 'tests: run' }}"
32
34
name : unit-tests (linux)
33
35
runs-on : ubuntu-latest
34
36
permissions :
40
42
matrix :
41
43
java : [8, 11, 17]
42
44
steps :
45
+ - name : Remove PR label
46
+ if : " ${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
47
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
48
+ with :
49
+ github-token : ${{ secrets.GITHUB_TOKEN }}
50
+ script : |
51
+ try {
52
+ await github.rest.issues.removeLabel({
53
+ name: 'tests: run',
54
+ owner: context.repo.owner,
55
+ repo: context.repo.repo,
56
+ issue_number: context.payload.pull_request.number
57
+ });
58
+ } catch (e) {
59
+ console.log('Failed to remove label. Another job may have already removed it!');
60
+ }
43
61
- name : Checkout code
44
62
uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
45
63
with :
@@ -75,13 +93,31 @@ jobs:
75
93
./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
76
94
77
95
windows :
96
+ # run job on proper workflow event triggers (skip job for pull_request event from forks and only run pull_request_target for "tests: run" label)
97
+ if : " ${{ (github.event.action != 'labeled' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) || github.event.label.name == 'tests: run' }}"
78
98
name : unit-tests (windows)
79
99
runs-on : windows-latest
80
100
permissions :
81
101
contents : " read"
82
102
id-token : " write"
83
103
issues : write
84
104
steps :
105
+ - name : Remove PR label
106
+ if : " ${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
107
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
108
+ with :
109
+ github-token : ${{ secrets.GITHUB_TOKEN }}
110
+ script : |
111
+ try {
112
+ await github.rest.issues.removeLabel({
113
+ name: 'tests: run',
114
+ owner: context.repo.owner,
115
+ repo: context.repo.repo,
116
+ issue_number: context.payload.pull_request.number
117
+ });
118
+ } catch (e) {
119
+ console.log('Failed to remove label. Another job may have already removed it!');
120
+ }
85
121
- name : Support longpaths
86
122
run : git config --system core.longpaths true
87
123
- name : Checkout code
0 commit comments