Use PR if given

This commit is contained in:
Corey Johnson 2020-05-07 10:30:51 -07:00
parent 1ea38af79c
commit 4b2f14d939

View file

@ -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
}