File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : PR approve GH Workflows
2
+
3
+ on :
4
+ pull_request_target :
5
+ types :
6
+ - labeled
7
+ - synchronize
8
+
9
+ jobs :
10
+ approve :
11
+ name : Approve ok-to-test
12
+ if : contains(github.event.pull_request.labels.*.name, 'ok-to-test')
13
+ runs-on : ubuntu-latest
14
+ permissions :
15
+ actions : write
16
+ steps :
17
+ - name : Update PR
18
+ uses : actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
19
+ continue-on-error : true
20
+ with :
21
+ github-token : ${{ secrets.GITHUB_TOKEN }}
22
+ script : |
23
+ const result = await github.rest.actions.listWorkflowRunsForRepo({
24
+ owner: context.repo.owner,
25
+ repo: context.repo.repo,
26
+ event: "pull_request",
27
+ status: "action_required",
28
+ head_sha: context.payload.pull_request.head.sha,
29
+ per_page: 100
30
+ });
31
+
32
+ for (var run of result.data.workflow_runs) {
33
+ await github.rest.actions.approveWorkflowRun({
34
+ owner: context.repo.owner,
35
+ repo: context.repo.repo,
36
+ run_id: run.id
37
+ });
38
+ }
You can’t perform that action at this time.
0 commit comments