diff --git a/api/queries_pr.go b/api/queries_pr.go index 6e5306f78..b3d380240 100644 --- a/api/queries_pr.go +++ b/api/queries_pr.go @@ -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) diff --git a/command/pr.go b/command/pr.go index fdf957c3b..26b2bc76d 100644 --- a/command/pr.go +++ b/command/pr.go @@ -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" {