MCPcopy Index your code
hub / github.com/cli/cli / PullRequestRevert

Function PullRequestRevert

api/queries_pr.go:798–827  ·  view source on GitHub ↗
(client *Client, repo ghrepo.Interface, params githubv4.RevertPullRequestInput)

Source from the content-addressed store, hash-verified

796}
797
798func PullRequestRevert(client *Client, repo ghrepo.Interface, params githubv4.RevertPullRequestInput) (*PullRequest, error) {
799 var mutation struct {
800 RevertPullRequest struct {
801 PullRequest struct {
802 ID githubv4.ID
803 }
804 RevertPullRequest struct {
805 ID string
806 Number int
807 URL string
808 }
809 } `graphql:"revertPullRequest(input: $input)"`
810 }
811
812 variables := map[string]interface{}{
813 "input": params,
814 }
815 err := client.Mutate(repo.RepoHost(), "PullRequestRevert", &mutation, variables)
816 if err != nil {
817 return nil, err
818 }
819 pr := &mutation.RevertPullRequest.RevertPullRequest
820 revertPR := &PullRequest{
821 ID: pr.ID,
822 Number: pr.Number,
823 URL: pr.URL,
824 }
825
826 return revertPR, nil
827}
828
829func ConvertPullRequestToDraft(client *Client, repo ghrepo.Interface, pr *PullRequest) error {
830 var mutation struct {

Callers 1

revertRunFunction · 0.92

Calls 2

MutateMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected