Return only basic pull request info when reverting a PR

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
This commit is contained in:
Lucas Melin 2025-10-22 18:00:16 -04:00
parent ef7ac8caab
commit 6db1441eb6
No known key found for this signature in database
2 changed files with 12 additions and 7 deletions

View file

@ -770,7 +770,11 @@ func PullRequestRevert(client *Client, repo ghrepo.Interface, params githubv4.Re
PullRequest struct {
ID githubv4.ID
}
RevertPullRequest PullRequest
RevertPullRequest struct {
ID string
Number int
URL string
}
} `graphql:"revertPullRequest(input: $input)"`
}
@ -781,7 +785,13 @@ func PullRequestRevert(client *Client, repo ghrepo.Interface, params githubv4.Re
if err != nil {
return nil, err
}
revertPR := &mutation.RevertPullRequest.RevertPullRequest
pr := &mutation.RevertPullRequest.RevertPullRequest
revertPR := &PullRequest{
ID: pr.ID,
Number: pr.Number,
URL: pr.URL,
}
return revertPR, nil
}

View file

@ -105,7 +105,6 @@ func TestPRRevert_acceptedIdentifierFormats(t *testing.T) {
"ID": "SOME-ID"
}, "revertPullRequest": {
"ID": "NEW-ID",
"Title": "Revert PR title",
"Number": 456,
"URL": "https://github.com/OWNER/REPO/pull/456"
} } } }
@ -162,7 +161,6 @@ func TestPRRevert_withTitleAndBody(t *testing.T) {
"ID": "SOME-ID"
}, "revertPullRequest": {
"ID": "NEW-ID",
"Title": "Revert PR title",
"Number": 456,
"URL": "https://github.com/OWNER/REPO/pull/456"
} } } }
@ -200,7 +198,6 @@ func TestPRRevert_withDraft(t *testing.T) {
"ID": "SOME-ID"
}, "revertPullRequest": {
"ID": "NEW-ID",
"Title": "Revert PR title",
"Number": 456,
"URL": "https://github.com/OWNER/REPO/pull/456"
} } } }
@ -266,7 +263,6 @@ func TestPRRevert_multipleInvocations(t *testing.T) {
"ID": "SOME-ID"
}, "revertPullRequest": {
"ID": "NEW-ID",
"Title": "Revert PR title",
"Number": 456,
"URL": "https://github.com/OWNER/REPO/pull/456"
} } } }
@ -297,7 +293,6 @@ func TestPRRevert_multipleInvocations(t *testing.T) {
"ID": "SOME-ID"
}, "revertPullRequest": {
"ID": "NEW-ID",
"Title": "Revert PR title",
"Number": 456,
"URL": "https://github.com/OWNER/REPO/pull/456"
} } } }