Merge pull request #3688 from cli/pr-merge-fix
Fix `pr merge` with GHE < 3.0
This commit is contained in:
commit
09a92c6e1d
5 changed files with 9 additions and 47 deletions
|
|
@ -208,6 +208,8 @@ func PullRequestGraphQL(fields []string) string {
|
|||
q = append(q, prFiles)
|
||||
case "commits":
|
||||
q = append(q, prCommits)
|
||||
case "lastCommit": // pseudo-field
|
||||
q = append(q, `commits(last:1){nodes{commit{oid}}}`)
|
||||
case "commitsCount": // pseudo-field
|
||||
q = append(q, `commits{totalCount}`)
|
||||
case "statusCheckRollup":
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ func mergeRun(opts *MergeOptions) error {
|
|||
|
||||
findOptions := shared.FindOptions{
|
||||
Selector: opts.SelectorArg,
|
||||
Fields: []string{"id", "number", "state", "title", "commits", "mergeable", "headRepositoryOwner", "headRefName"},
|
||||
Fields: []string{"id", "number", "state", "title", "lastCommit", "mergeable", "headRepositoryOwner", "headRefName"},
|
||||
}
|
||||
pr, baseRepo, err := opts.Finder.Find(findOptions)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -464,11 +464,8 @@ func Test_nonDivergingPullRequest(t *testing.T) {
|
|||
}
|
||||
stubCommit(pr, "COMMITSHA1")
|
||||
|
||||
shared.RunCommandFinder(
|
||||
"",
|
||||
pr,
|
||||
baseRepo("OWNER", "REPO", "master"),
|
||||
)
|
||||
prFinder := shared.RunCommandFinder("", pr, baseRepo("OWNER", "REPO", "master"))
|
||||
prFinder.ExpectFields([]string{"id", "number", "state", "title", "lastCommit", "mergeable", "headRepositoryOwner", "headRefName"})
|
||||
|
||||
http.Register(
|
||||
httpmock.GraphQL(`mutation PullRequestMerge\b`),
|
||||
|
|
@ -505,11 +502,8 @@ func Test_divergingPullRequestWarning(t *testing.T) {
|
|||
}
|
||||
stubCommit(pr, "COMMITSHA1")
|
||||
|
||||
shared.RunCommandFinder(
|
||||
"",
|
||||
pr,
|
||||
baseRepo("OWNER", "REPO", "master"),
|
||||
)
|
||||
prFinder := shared.RunCommandFinder("", pr, baseRepo("OWNER", "REPO", "master"))
|
||||
prFinder.ExpectFields([]string{"id", "number", "state", "title", "lastCommit", "mergeable", "headRepositoryOwner", "headRefName"})
|
||||
|
||||
http.Register(
|
||||
httpmock.GraphQL(`mutation PullRequestMerge\b`),
|
||||
|
|
|
|||
|
|
@ -12,24 +12,7 @@
|
|||
"state": "CLOSED",
|
||||
"url": "https://github.com/cli/cli/pull/8",
|
||||
"headRefName": "blueberries",
|
||||
"reviewDecision": "CHANGES_REQUESTED",
|
||||
"commits": {
|
||||
"nodes": [
|
||||
{
|
||||
"commit": {
|
||||
"statusCheckRollup": {
|
||||
"contexts": {
|
||||
"nodes": [
|
||||
{
|
||||
"state": "SUCCESS"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"reviewDecision": "CHANGES_REQUESTED"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -12,24 +12,7 @@
|
|||
"state": "MERGED",
|
||||
"url": "https://github.com/cli/cli/pull/8",
|
||||
"headRefName": "blueberries",
|
||||
"reviewDecision": "CHANGES_REQUESTED",
|
||||
"commits": {
|
||||
"nodes": [
|
||||
{
|
||||
"commit": {
|
||||
"statusCheckRollup": {
|
||||
"contexts": {
|
||||
"nodes": [
|
||||
{
|
||||
"state": "SUCCESS"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"reviewDecision": "CHANGES_REQUESTED"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue