-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find open PRs on your forks #2268
Comments
Possible starting point: https://stackoverflow.com/a/55125453/288906 |
I can take care of it. Already played with GraphQL queries for this and I found a possible solution. {
search(query: "repo:sindresorhus/refined-github is:pr is:open author:Esemesek", type: ISSUE, last: 100) {
edges {
node {
... on PullRequest {
url
title
createdAt
isCrossRepository
headRepository {
owner {
login
}
name
}
}
}
}
}
} With this query, we should be able to find out all the open PRs for a fork. |
Sounds good |
@jerone has funded $5.00 to this issue.
|
I think there are two approachs to do this
I think this really depends on what this feature should do. The query for this could look like this: {
repository(name: "refined-github", owner: "busches") {
refs(refPrefix: "refs/heads/", first: 100) {
nodes {
associatedPullRequests(states: OPEN) {
totalCount
}
}
}
}
} Example Response{
"data": {
"repository": {
"refs": {
"nodes": [
{
"associatedPullRequests": {
"totalCount": 1
}
},
{
"associatedPullRequests": {
"totalCount": 0
}
}
]
}
}
}
} If the sum of all It would also be possible to check for I already have a working example for this here. So I guess it now depends what should be displayed where and if all PRs of the fork count or just cross repository or even only to the parent. |
My guess is that associatedPullRequests includes both local and cross-repo PRs, so if if there are 5 local PRs and 2 cross repo, the count returned should be 7. The Pull Request tab would show 5 and we could attach a Additionally we could show “there are X open PRs from this repo” on the deletion page/popup |
This might require to only count the So the query would then be like this: {
repository(name: "refined-github", owner: "busches") {
pullRequests(states: OPEN) {
totalCount
}
refs(refPrefix: "refs/heads/", first: 100) {
nodes {
associatedPullRequests(states: OPEN, first: 100) {
nodes {
isCrossRepository
}
}
}
}
}
}
|
No you don’t need to query it from the API because the number is already in the tab itself, right? |
Yes it wouldn't be needed but it doesn't really complicate the query so I think it wouldn't matter where to get it from. |
Wow, I did not find anything about this via search, so I just typed out a whole issue to suggest this feature... but I guess GitHub's "similar issues" feature got the better of me. 😁 I'm not familiar with the v4 API, but I found a very easy v3 request to get the according PRs using the https://api.github.com/search/issues?q=repo:mautic/mautic+is:pr+is:open+author:loilo I'd be happy to implement this. The visualization in the header could be like this: What do you think? |
It looks great! API v4 should work similarly, the query should be something like, off of my head: {
search(query: 'blah blah', type: ISSUE) {
issueCount
}
} You can use GitHub GraphQL Explorer to figure it out. The good part is that the response will literally be 20 bytes of text instead of KBs of useless data that the v3 API returns. |
Good point. I'll try to figure it out. |
@sindresorhus has rewarded $4.50 to @loilo. See it on IssueHunt
|
Usually forks are only useful to send PRs. When your open PRs are merged, they should be deleted.
Finding out whether your fork is still needed takes too long (open source repo, go to PRs, look for your PRs).
Refined GitHub should mention your open PRs in:
Ideally this should check whether there are any branches ahead of source like https://github.com/denis-sokolov/remove-github-forks does, but checking for PRs alone would make this feature a good companion to that CLI tool.
IssueHunt Summary
loilo has been rewarded.
Backers (Total: $5.00)
Submitted pull Requests
show-open-prs-of-forks
featureTips
IssueHunt has been backed by the following sponsors. Become a sponsor
The text was updated successfully, but these errors were encountered: