Skip to content

Commit a57b75e

Browse files
authored
Add support for reassign-reviewer through label (#15422)
1 parent 29fc5fc commit a57b75e

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

.ci/magician/cmd/reassign_reviewer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ func execReassignReviewer(prNumber, newPrimaryReviewer string, gh GithubClient)
111111
return err
112112
}
113113

114+
gh.RemoveLabel(prNumber, "assign-reviewer")
115+
114116
return nil
115117
}
116118

.github/workflows/reassign-reviewer.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ on:
66
issue_comment:
77
types:
88
- created
9-
9+
pull_request:
10+
types:
11+
- labeled
1012

1113
jobs:
12-
reassign-reviewer:
13-
if: ${{ github.event.issue.pull_request }}
14+
reassign-reviewer-from-comment:
15+
if: ${{ github.event.issue.pull_request && github.event_name == 'issue_comment' }}
1416
runs-on: ubuntu-22.04
1517
permissions:
1618
pull-requests: write
@@ -41,3 +43,26 @@ jobs:
4143
- name: Run command
4244
if: steps.read-comment.outputs.match != ''
4345
run: .ci/magician/magician reassign-reviewer ${{ github.event.issue.number }} ${{ github.event.comment.user.login }} ${{ steps.read-comment.outputs.group1 }}
46+
47+
reassign-reviewer-from-label:
48+
if: ${{ github.event_name == 'pull_request' && github.event.label.name == 'assign-reviewer' }}
49+
runs-on: ubuntu-22.04
50+
permissions:
51+
pull-requests: write
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
steps:
55+
- name: Checkout Repository
56+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
57+
with:
58+
ref: main
59+
- name: Set up Go
60+
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
61+
with:
62+
go-version: '^1.21'
63+
- name: Build magician
64+
run: |
65+
cd .ci/magician
66+
go build .
67+
- name: Run command
68+
run: .ci/magician/magician reassign-reviewer ${{ github.event.pull_request.number }} ${{ github.event.sender.login }}

0 commit comments

Comments
 (0)