MCPcopy Create free account
hub / github.com/cli/cli / PullRequestRevert

Function PullRequestRevert

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

Source from the content-addressed store, hash-verified

821}
822
823func PullRequestRevert(client *Client, repo ghrepo.Interface, params githubv4.RevertPullRequestInput) (*PullRequest, error) {
824 var mutation struct {
825 RevertPullRequest struct {
826 PullRequest struct {
827 ID githubv4.ID
828 }
829 RevertPullRequest struct {
830 ID string
831 Number int
832 URL string
833 }
834 } `graphql:"revertPullRequest(input: $input)"`
835 }
836
837 variables := map[string]any{
838 "input": params,
839 }
840 err := client.Mutate(repo.RepoHost(), "PullRequestRevert", &mutation, variables)
841 if err != nil {
842 return nil, err
843 }
844 pr := &mutation.RevertPullRequest.RevertPullRequest
845 revertPR := &PullRequest{
846 ID: pr.ID,
847 Number: pr.Number,
848 URL: pr.URL,
849 }
850
851 return revertPR, nil
852}
853
854func ConvertPullRequestToDraft(client *Client, repo ghrepo.Interface, pr *PullRequest) error {
855 var mutation struct {

Callers 1

revertRunFunction · 0.92

Calls 2

MutateMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected