Have PullRequestForBranch accept "owner:branch" value for forks
When on a `patch-1` branch locally, `gh pr view` would happily open the first open PR it finds with "patch-1" as its head, even those coming from forks.
This commit is contained in:
parent
c7a38b6331
commit
508f6787f0
5 changed files with 77 additions and 81 deletions
12
test/fixtures/prStatus.json
vendored
12
test/fixtures/prStatus.json
vendored
|
|
@ -7,7 +7,11 @@
|
|||
"number": 10,
|
||||
"title": "Blueberries are a good fruit",
|
||||
"url": "https://github.com/github/gh-cli/pull/10",
|
||||
"headRefName": "[blueberries]"
|
||||
"headRefName": "blueberries",
|
||||
"headRepositoryOwner": {
|
||||
"login": "OWNER"
|
||||
},
|
||||
"isCrossRepository": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -20,7 +24,7 @@
|
|||
"number": 8,
|
||||
"title": "Strawberries are not actually berries",
|
||||
"url": "https://github.com/github/gh-cli/pull/8",
|
||||
"headRefName": "[strawberries]"
|
||||
"headRefName": "strawberries"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
@ -33,7 +37,7 @@
|
|||
"number": 9,
|
||||
"title": "Apples are tasty",
|
||||
"url": "https://github.com/github/gh-cli/pull/9",
|
||||
"headRefName": "[apples]"
|
||||
"headRefName": "apples"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -41,7 +45,7 @@
|
|||
"number": 11,
|
||||
"title": "Figs are my favorite",
|
||||
"url": "https://github.com/github/gh-cli/pull/1",
|
||||
"headRefName": "[figs]"
|
||||
"headRefName": "figs"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
|||
68
test/fixtures/prView.json
vendored
68
test/fixtures/prView.json
vendored
|
|
@ -1,50 +1,30 @@
|
|||
{"data":{
|
||||
"repository": {
|
||||
"pullRequests": {
|
||||
"edges": [
|
||||
{
|
||||
"node": {
|
||||
{
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequests": {
|
||||
"nodes": [
|
||||
{
|
||||
"number": 12,
|
||||
"title": "Blueberries are from a fork",
|
||||
"url": "https://github.com/OWNER/REPO/pull/12",
|
||||
"headRefName": "blueberries",
|
||||
"headRepositoryOwner": {
|
||||
"login": "hubot"
|
||||
},
|
||||
"isCrossRepository": true
|
||||
},
|
||||
{
|
||||
"number": 10,
|
||||
"title": "Blueberries are a good fruit",
|
||||
"url": "https://github.com/OWNER/REPO/pull/10",
|
||||
"headRefName": "[blueberries]"
|
||||
"headRefName": "blueberries",
|
||||
"headRepositoryOwner": {
|
||||
"login": "OWNER"
|
||||
},
|
||||
"isCrossRepository": false
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"viewerCreated": {
|
||||
"edges": [
|
||||
{
|
||||
"node": {
|
||||
"number": 8,
|
||||
"title": "Strawberries are not actually berries",
|
||||
"url": "https://github.com/OWNER/REPO/pull/8",
|
||||
"headRefName": "[strawberries]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"pageInfo": { "hasNextPage": false }
|
||||
},
|
||||
"reviewRequested": {
|
||||
"edges": [
|
||||
{
|
||||
"node": {
|
||||
"number": 9,
|
||||
"title": "Apples are tasty",
|
||||
"url": "https://github.com/OWNER/REPO/pull/9",
|
||||
"headRefName": "[apples]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"node": {
|
||||
"number": 11,
|
||||
"title": "Figs are my favorite",
|
||||
"url": "https://github.com/OWNER/REPO/pull/1",
|
||||
"headRefName": "[figs]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"pageInfo": { "hasNextPage": false }
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue