Do you want to work on this issue?
You can request for a bounty in order to promote it!
Show pull requests to source repo on fork's branch list #2914
jack1142 posted onGitHub
When some branch on the repo is a head of PR made to that repo, the PR is shown near the branch on branch list:
I think it would be great if branch list on forks also included the PRs that are made to their source repo so that user could figure out easily which branches can be removed.
Example URL: https://github.com/jack1142/Red-DiscordBot/branches/all
Why all PRs? The point here is to highlight forks that you can/cannot delete, closed PRs don’t seem important for that.
The point here is to highlight forks that you can/cannot delete
It's definitely not the point for me, I thought that for the case you're mentioning, there's already this feature:
Why all PRs?
I can think of few reasons:
a) GitHub shows associated PR on branch list no matter if it's closed, merged or open so I think it would be good if this feature were consistent with original behavior.
b) not all branches are associated to a PR therefore you can't differentiate easily between branches that are part of closed or merged PR and branches that never had their PR
c) seeing associated PR can serve as a better summary of the work done in the branch - at the very least you can see the title of PR when you hover on its number in branch list and that view also shows small part of description and PR's labels
That info can be useful even if the PR has already been merged or closed.
d) if PR was just closed instead of getting merged, it's important to know that removing the branch can cause you losing your work. I'm sure there are plenty of cases when PR doesn't end up being merged
It's definitely not the point for me, I thought that for the case you're mentioning, there's already this feature:
D'oh, I thought we were talking about that feature. Sorry!
As long as we only show one PR per branch this should be ok, otherwise the layout breaks.
This could work:
{
repository(owner: "jack1142", name: "Red-DiscordBot") {
refs(refPrefix: "refs/heads/", last: 100) {
nodes {
name
associatedPullRequests(last: 1, states: [CLOSED, OPEN]) {
nodes {
number
url
}
}
}
}
}
}
Ideally you'd query each of the visible branches instead but the query I tried didn't include closed PRs (I tried via repository.ref().associatedPullRequests()
and repository().object().associatedPullRequests()
)
Ideally you'd query each of the visible branches instead but the query I tried didn't include closed PRs (I tried via
repository.ref().associatedPullRequests()
andrepository().object().associatedPullRequests()
)
Can you explain what you had in mind with this comment?
Also why are you limiting it to only closed and open states?
My last example just asks GitHub for the last 100 branches and their related PR. Ideally instead you'd ask GitHub just for the PRs that are currently on screen, like
{
repository(...) {
branchA: ref('branchA') {
associatedPullRequests(...) {
...
}
}
branchB: ref('branchB') {
associatedPullRequests(...) {
...
}
}
...
}
}
But none of the queries I tried included closed/merged PRs; they only returned open PRs. If anyone finds a way to query branches this way AND their related PR (even if closed) it's preferable instead of my last example.
Also why are you limiting it to only closed and open states?
Mistake. I meant open/closed/merged.
@fregante
{
repository(owner: "yakov116", name: "refined-github") {
console_errors: ref(qualifiedName: "console_errors") {
associatedPullRequests(last: 1) {
nodes {
number
state
}
}
}
clone_branch: ref(qualifiedName: "restore-clone-branch") {
associatedPullRequests(last: 1) {
nodes {
number
state
}
}
}
}
}
{
"data": {
"repository": {
"console_errors": {
"associatedPullRequests": {
"nodes": [
{
"number": 2956,
"state": "CLOSED"
}
]
}
},
"clone_branch": {
"associatedPullRequests": {
"nodes": [
{
"number": 3000,
"state": "MERGED"
}
]
}
}
}
}
}
Unless you had something else in mind.
I would much rather do the last 100 PR's since any search will require a new request. i also think its safe to say that most people with a fork have less than 100 branches
Edit: Showing that it works for merged
In that case, isn't it simpler to just do it like here? https://github.com/sindresorhus/refined-github/issues/2914#issuecomment-611243565
In that case, isn't it simpler to just do it like here? #2914 (comment)
I learned the hard way; when @fregante says something, follow it. Have questions... ask later.
In that case, isn't it simpler to just do it like here?
That works, but if the alternative option is possible the result is safer and lighter. If it’s not possible, then sure.
I would much rather do the last 100 PR's since any search will require a new request. i also think its safe to say that most people with a fork have less than 100 branches
Maybe you’re right
Confirmed plan b?