Skip to content

Commit 9317eab

Browse files
authored
Enable parse comment and delete old flow (#15734)
1 parent 1d19318 commit 9317eab

File tree

3 files changed

+53
-128
lines changed

3 files changed

+53
-128
lines changed

.ci/magician/cmd/parse_comment.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func routeCommand(prNumber, commandLine string, gh GithubClient) error {
108108
}
109109

110110
// handleReassignReviewer processes the reassign-reviewer command
111-
func handleReassignReviewer(prNumber, reviewer string, _ GithubClient) error {
111+
func handleReassignReviewer(prNumber, reviewer string, gh GithubClient) error {
112112
// The regex already extracted just the username without @
113113
// and only allows valid GitHub username characters [a-zA-Z0-9-_]
114114

@@ -119,12 +119,7 @@ func handleReassignReviewer(prNumber, reviewer string, _ GithubClient) error {
119119
fmt.Printf(" (selecting random reviewer)")
120120
}
121121
fmt.Println()
122-
123-
fmt.Printf("[DEBUG] - placeholder call - prNumber: %s, reviewer %s\n", prNumber, reviewer)
124-
return nil
125-
126-
// Call the existing reassign reviewer logic
127-
// return execReassignReviewer(prNumber, reviewer, gh)
122+
return execReassignReviewer(prNumber, reviewer, gh)
128123
}
129124

130125
func init() {

.ci/magician/cmd/parse_comment_test.go

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -242,42 +242,42 @@ func TestExecParseComment(t *testing.T) {
242242
expectCommentUpdate bool
243243
expectCommentCreate bool
244244
}{
245-
// "reassign-reviewer with hyphen and specific user": {
246-
// comment: "LGTM! @modular-magician reassign-reviewer alice",
247-
// existingComments: []github.PullRequestComment{
248-
// {
249-
// Body: github.FormatReviewerComment("bob"),
250-
// ID: 1234,
251-
// },
252-
// },
253-
// expectSpecificReviewers: []string{"alice"},
254-
// expectRemovedReviewers: []string{"bob"},
255-
// expectCommentUpdate: true,
256-
// },
257-
// "reassign to random reviewer (no username specified)": {
258-
// comment: "@modular-magician reassign-reviewer",
259-
// existingComments: []github.PullRequestComment{
260-
// {
261-
// Body: github.FormatReviewerComment("george"),
262-
// ID: 3456,
263-
// },
264-
// },
265-
// expectRemovedReviewers: []string{"george"},
266-
// expectCommentUpdate: true,
267-
// // Can't check specific reviewer since it's random
268-
// },
269-
// "multiple @modular-magician invocations (only first processed)": {
270-
// comment: "@modular-magician reassign-reviewer larry\n@modular-magician reassign-reviewer mary",
271-
// existingComments: []github.PullRequestComment{
272-
// {
273-
// Body: github.FormatReviewerComment("nancy"),
274-
// ID: 1111,
275-
// },
276-
// },
277-
// expectSpecificReviewers: []string{"larry"}, // Only larry, not mary
278-
// expectRemovedReviewers: []string{"nancy"},
279-
// expectCommentUpdate: true,
280-
// },
245+
"reassign-reviewer with hyphen and specific user": {
246+
comment: "LGTM! @modular-magician reassign-reviewer alice",
247+
existingComments: []github.PullRequestComment{
248+
{
249+
Body: github.FormatReviewerComment("bob"),
250+
ID: 1234,
251+
},
252+
},
253+
expectSpecificReviewers: []string{"alice"},
254+
expectRemovedReviewers: []string{"bob"},
255+
expectCommentUpdate: true,
256+
},
257+
"reassign to random reviewer (no username specified)": {
258+
comment: "@modular-magician reassign-reviewer",
259+
existingComments: []github.PullRequestComment{
260+
{
261+
Body: github.FormatReviewerComment("george"),
262+
ID: 3456,
263+
},
264+
},
265+
expectRemovedReviewers: []string{"george"},
266+
expectCommentUpdate: true,
267+
// Can't check specific reviewer since it's random
268+
},
269+
"multiple @modular-magician invocations (only first processed)": {
270+
comment: "@modular-magician reassign-reviewer larry\n@modular-magician reassign-reviewer mary",
271+
existingComments: []github.PullRequestComment{
272+
{
273+
Body: github.FormatReviewerComment("nancy"),
274+
ID: 1111,
275+
},
276+
},
277+
expectSpecificReviewers: []string{"larry"}, // Only larry, not mary
278+
expectRemovedReviewers: []string{"nancy"},
279+
expectCommentUpdate: true,
280+
},
281281
"no @modular-magician invocation": {
282282
comment: "Just a regular comment without magician",
283283
expectNoAction: true,
@@ -290,23 +290,23 @@ func TestExecParseComment(t *testing.T) {
290290
comment: "@modular-magician cherry-pick branch-xyz",
291291
expectNoAction: true,
292292
},
293-
// "command in middle of multi-line comment": {
294-
// comment: `This looks good to me.
295-
// LGTM!
293+
"command in middle of multi-line comment": {
294+
comment: `This looks good to me.
295+
LGTM!
296296
297-
// @modular-magician reassign-reviewer rachel
297+
@modular-magician reassign-reviewer rachel
298298
299-
// Thanks for the great work!`,
300-
// existingComments: []github.PullRequestComment{
301-
// {
302-
// Body: github.FormatReviewerComment("steve"),
303-
// ID: 3333,
304-
// },
305-
// },
306-
// expectSpecificReviewers: []string{"rachel"},
307-
// expectRemovedReviewers: []string{"steve"},
308-
// expectCommentUpdate: true,
309-
// },
299+
Thanks for the great work!`,
300+
existingComments: []github.PullRequestComment{
301+
{
302+
Body: github.FormatReviewerComment("steve"),
303+
ID: 3333,
304+
},
305+
},
306+
expectSpecificReviewers: []string{"rachel"},
307+
expectRemovedReviewers: []string{"steve"},
308+
expectCommentUpdate: true,
309+
},
310310
}
311311

312312
for tn, tc := range cases {

.github/workflows/reassign-reviewer.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)