-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Show significant branches on PRs list #1641
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
Show significant branches on PRs list #1641
Conversation
|
This is great, but it should be done via API v4 to make them appear at once and to avoid making up to 25 API v3 request at the same time. |
|
I think we should drop the username prefix when it's the same as the current repo.
|
|
@bfred-it Should we add to the contribution guidelines that new features should prefer the v4 API? |
|
@bfred-it commented on Nov 29, 2018, 4:14 AM GMT+1:
I'll have a look again into v4. I tried it, but it wasn't that simple as v3. |
|
Ok, I think I've got the correct query: {
repository(owner: "${owner}", name: "${repo}") {
pullRequest(number: ${number}) {
baseRef {
name
repository {
url
owner {
login
}
}
}
headRef {
name
repository {
url
owner {
login
}
}
}
}
}
}I just need to figure out how to do it with a list of ids... |
Sure |
|
@bfred-it commented on Nov 29, 2018, 8:23 AM GMT+1:
You mean that with GraphQL it should fetch all the PR's in a project and then in the code find the correct PR? |
|
Maybe you can use the
Unfortunately, it seems GraphQL doesn't do batch queries: |
Sure it can, that's what I showed in my previous link. You can't specify a simple list of IDs but you can request multiple things in the same query
No, you can fetch the specific IDs in the same query, so instead of: {
repository(owner: "${owner}", name: "${repo}") {
pullRequest(number: ${number}) {
baseRef {etc}
headRef {etc}
}
}your query would be: {
id134: repository(owner: "${owner}", name: "${repo}") {
pullRequest(number: 134) {
baseRef {etc}
headRef {etc}
}
}
id200: repository(owner: "${owner}", name: "${repo}") {
pullRequest(number: 200) {
baseRef {etc}
headRef {etc}
}
}
id566: repository(owner: "${owner}", name: "${repo}") {
pullRequest(number: 566) {
baseRef {etc}
headRef {etc}
}
}
}or {
repository(owner: "${owner}", name: "${repo}") {
id134: pullRequest(number: 134) {
baseRef {etc}
headRef {etc}
}
id200: pullRequest(number: 200) {
baseRef {etc}
headRef {etc}
}
id566: pullRequest(number: 566) {
baseRef {etc}
headRef {etc}
}
}
}essentially querying all the PRs you see on a page, but in a single request. You can see a live implementation here: https://github.com/bfred-it/github-issue-link-status/blob/master/source/content.js and perhaps you can steal a lot of code from it |
|
@sindresorhus & @bfred-it I just finished this PR 🎉, care to review again. |
This comment has been minimized.
This comment has been minimized.
@yakov116 Why? What's your use-case for this? |
|
I've been using this PR for some additional days now and my experience is that showing non-default head branch (E.g. Does anyone have any use-cases for having non-default base branch (E.g. |
Co-Authored-By: jerone <jeronevw@hotmail.com>
|
The use case for me (and team) is that we use a convention for naming branches:
For example on this branch name
This way I can see I one glance all the information what I needed, without checking out the branch or opening the PR. |
|
Looks like information that doesn’t belong to the branch name.
In short you can use them in your branch name but they don’t add much to the PR list, imho |
That's fine. To explain, these conventions are there for branch naming; it doesn't mean that a PR is always being created. But it was asked for an use-case, this is our use-case, and one of the reasons I created this PR. |
When I filter pull requests that I made I like to know if I made it from a patch (online) or I created it local |
|
I reverted that part to avoid too much noise in the PR list. This is ready to be merged |
|
Drop |
|
Yes |

This PR will append the base & head branches to each PR list-item in the PRs overview.
Screenshot

Issues
Closes #190
Closes #103
TODO
Cache the branches when opening a single PR.Notes
It looks like the caching mechanism doesn't work. At least in this case it never returns a cached value.
I'm curious to your opinions...