From 4b2f14d9390d563e69680de68dac51e28e7d2bed Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Thu, 7 May 2020 10:30:51 -0700 Subject: [PATCH] Use PR if given --- command/pr.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/command/pr.go b/command/pr.go index c7f74d256..9691b9ba7 100644 --- a/command/pr.go +++ b/command/pr.go @@ -451,12 +451,16 @@ func prMerge(cmd *cobra.Command, args []string) error { return err } } else { - _, branchWithOwner, err := prSelectorForCurrentBranch(ctx, baseRepo) + prNumber, branchWithOwner, err := prSelectorForCurrentBranch(ctx, baseRepo) if err != nil { return err } - pr, err = api.PullRequestForBranch(apiClient, baseRepo, "", branchWithOwner) + if prNumber != 0 { + pr, err = api.PullRequestByNumber(apiClient, baseRepo, prNumber) + } else { + pr, err = api.PullRequestForBranch(apiClient, baseRepo, "", branchWithOwner) + } if err != nil { return err }