Skip to content

Commit a8199b1

Browse files
wip
1 parent 622ef3c commit a8199b1

3 files changed

Lines changed: 44 additions & 8 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
actions: write
15+
16+
jobs:
17+
test-robot-label:
18+
name: Job
19+
uses: ./.github/workflows/test-robot-label.yml
20+
with:
21+
label-test-robot-done: test-robot-done
22+
label-test-robot-needed: test-robot-needed

.github/workflows/pull-request.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: PR
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened, labeled]
5+
types: [opened, synchronize, reopened]
66

77
concurrency:
88
group: ${{ github.workflow }}-${{ github.ref }}
@@ -22,13 +22,6 @@ jobs:
2222
label-test-robot-done: test-robot-done
2323
label-test-robot-needed: test-robot-needed
2424

25-
test-robot-label:
26-
name: Job
27-
uses: ./.github/workflows/test-robot-label.yml
28-
with:
29-
label-test-robot-done: test-robot-done
30-
label-test-robot-needed: test-robot-needed
31-
3225
build:
3326
name: Job
3427
uses: ./.github/workflows/build.yml

.github/workflows/test-robot-label.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717
permissions:
1818
contents: read
1919
pull-requests: write
20+
actions: write
2021

2122
jobs:
2223
test-robot-label:
@@ -32,3 +33,23 @@ jobs:
3233
with:
3334
label-test-robot-done: ${{ inputs.label-test-robot-done }}
3435
label-test-robot-needed: ${{ inputs.label-test-robot-needed }}
36+
37+
- name: Rerun pull-request workflow
38+
uses: actions/github-script@v7
39+
with:
40+
script: |
41+
const runs = await github.rest.actions.listWorkflowRunsForRepo({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
workflow_id: 'pull-request.yml',
45+
event: 'pull_request',
46+
head_sha: context.payload.pull_request.head.sha,
47+
});
48+
const run = runs.data.workflow_runs[0];
49+
if (run) {
50+
await github.rest.actions.reRunWorkflow({
51+
owner: context.repo.owner,
52+
repo: context.repo.repo,
53+
run_id: run.id,
54+
});
55+
}

0 commit comments

Comments
 (0)