From c225d379a9599041b784c2be31e00380f66502a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 13 May 2020 12:09:59 +0200 Subject: [PATCH] Preserve CODEOWNERS reviewers in `pr create` When reviewers were requested on a PR, they would apparently overwrite the current set of reviewers. A fresh PR will already have reviewers if it was assigned some by CODEOWNERS rules. The fix is to only ever add additional reviewers and not overwrite the entire set. --- api/queries_pr.go | 1 + command/pr_create_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/api/queries_pr.go b/api/queries_pr.go index c1afc6bc9..c0b16f3c4 100644 --- a/api/queries_pr.go +++ b/api/queries_pr.go @@ -667,6 +667,7 @@ func CreatePullRequest(client *Client, repo *Repository, params map[string]inter requestReviews(input: $input) { clientMutationId } }` reviewParams["pullRequestId"] = pr.ID + reviewParams["union"] = true variables := map[string]interface{}{ "input": reviewParams, } diff --git a/command/pr_create_test.go b/command/pr_create_test.go index 85966aa72..d6b89a6b0 100644 --- a/command/pr_create_test.go +++ b/command/pr_create_test.go @@ -184,6 +184,7 @@ func TestPRCreate_metadata(t *testing.T) { eq(t, inputs["pullRequestId"], "NEWPULLID") eq(t, inputs["userIds"], []interface{}{"HUBOTID"}) eq(t, inputs["teamIds"], []interface{}{"COREID"}) + eq(t, inputs["union"], true) })) cs, cmdTeardown := test.InitCmdStubber()