Can be marked ready for review

This commit is contained in:
Corey Johnson 2020-05-18 12:42:16 -07:00
parent fad9f24f39
commit 922b6e06e0
2 changed files with 23 additions and 7 deletions

View file

@ -962,13 +962,12 @@ func PullRequestReady(client *Client, repo ghrepo.Interface, pr *PullRequest) er
} `graphql:"markPullRequestReadyForReview(input: $input)"`
}
input := struct {
// ID of the pull request to be reopened. (Required.)
type MarkPullRequestReadyForReviewInput struct {
PullRequestID githubv4.ID `json:"pullRequestId"`
}{
PullRequestID: pr.ID,
}
input := MarkPullRequestReadyForReviewInput{PullRequestID: pr.ID}
v4 := githubv4.NewClient(client.http)
err := v4.Mutate(context.Background(), &mutation, input, nil)

View file

@ -569,9 +569,26 @@ func prReady(cmd *cobra.Command, args []string) error {
return err
}
pr, err := prFromArg(apiClient, baseRepo, args[0])
if err != nil {
return err
var pr *api.PullRequest
if len(args) > 0 {
pr, err = prFromArg(apiClient, baseRepo, args[0])
if err != nil {
return err
}
} else {
prNumber, branchWithOwner, err := prSelectorForCurrentBranch(ctx, baseRepo)
if err != nil {
return err
}
if prNumber != 0 {
pr, err = api.PullRequestByNumber(apiClient, baseRepo, prNumber)
} else {
pr, err = api.PullRequestForBranch(apiClient, baseRepo, "", branchWithOwner)
}
if err != nil {
return err
}
}
// if pr.State == "MERGED" {