You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: for example, in the React team, much of the work happens via PRs, even by the core team. However, these core team PRs are lost in the long, long list of contributions.
Proposal: highlight PRs that are from members of the repo owning org, Facebook in the example of React.
Reacted by Harry Dobrev, Sindre Sorhus and Jeroen van Warmerdam
It doesn't look like GraphQL simplifies things in this case, from what I understand the only advantage is getting only what's needed as opposed to a big JSON.
I hoped you could query the visible user names directly but I don't think that's possible.
Just stumbled upon this and if I find the time I will take another look at it, but I see two ways to solve this.
1. Get all members of an organisation
This would be the best way if the members could be reused (maybe in the Author filter) and/or saved for that repository/organisation context so we only need to get them once.
A query could look like this:
If the passed $org isn't an organization the response would be an error/empty.
{
"data": {
"organization": null
},
"errors": [
{
"message": "Could not resolve to an Organization with the login of 'bfred-it'.",
"type": "NOT_FOUND",
"path": [
"organization"
],
"locations": [
{
"line": 2,
"column": 3
}
]
}
]
}
2. Test the organization connection for each user
This would mean that we have a list of users we want to test.
Instead of the suggested query of @bfred-it it would also be possible to test for that one organization.
There is no indication if the $org is actually an organization
The query can't be build that easily and could lead to problems, e.g. there is a limit to how many users could be request at once (something around 50 when I tested it)
There is no indication if the $org is actually an organization
This might need a separate request for each user, perhaps cached forever.
The query can't be build that easily and could lead to problems, e.g. there is a limit to how many users could be request at once (something around 50 when I tested it)
Activity
fregante commentedon May 26, 2017
I think we'd need an API key for that. This works, but it needs pagination for orgs with 101+ members:
Once v4 goes public we can get a much lighter response (but still paginated):
sindresorhus commentedon May 26, 2017
I think we should wait for the GraphQL API. It will make this much simpler to implement.
markspolakovs commentedon May 26, 2017
If you mean "wait for it to come out of early access", see https://github.com/blog/2359-introducing-github-marketplace-and-more-tools-to-customize-your-workflow
fregante commentedon May 26, 2017
It doesn't look like GraphQL simplifies things in this case, from what I understand the only advantage is getting only what's needed as opposed to a big JSON.
I hoped you could query the visible user names directly but I don't think that's possible.
[-]Feature request: Highlight issues and PRs from org members[/-][+]Highlight issues and PRs from org members[/+]fregante commentedon Jan 16, 2018
This is actually sort of possible in a single GraphQL query:
This lets you query multiple specific users at once for their organizations.
It still is paginated but I doubt that there are many users that joined more than 100 orgs.
However: I don't know how you can tell if the current repo is part of an organization, I see no clues in the HTML.
dertieran commentedon Sep 4, 2018
Just stumbled upon this and if I find the time I will take another look at it, but I see two ways to solve this.
1. Get all members of an organisation
This would be the best way if the members could be reused (maybe in the Author filter) and/or saved for that repository/organisation context so we only need to get them once.
A query could look like this:
This would return a list of members and the page information
{ "data": { "organization": { "login": "bfred-it-obsolete", "members": { "pageInfo": { "hasNextPage": false, "endCursor": "Y3Vyc29yOnYyOpHOABVlgQ==" }, "nodes": [ { "login": "bfred-it" } ] } } } }If the passed
$orgisn't an organization the response would be an error/empty.{ "data": { "organization": null }, "errors": [ { "message": "Could not resolve to an Organization with the login of 'bfred-it'.", "type": "NOT_FOUND", "path": [ "organization" ], "locations": [ { "line": 2, "column": 3 } ] } ] }2. Test the
organizationconnection for each userThis would mean that we have a list of users we want to test.
Instead of the suggested query of @bfred-it it would also be possible to test for that one
organization.This would return the
organizationornullif the user isn't a member{ "data": { "sindresorhus": { "organization": null }, "bfredit": { "organization": { "login": "bfred-it-obsolete" } } } }Two problems I can see here are that
$orgis actually an organizationfregante commentedon Sep 5, 2018
This might need a separate request for each user, perhaps cached forever.
The PR list only shows 20 PRs at a time, so that's not much of an issue. I built this type of query for my other extension, perhaps you can just copy-paste most of it: https://github.com/bfred-it/github-issue-link-status/blob/a079c3db069e16374713708b521254cecc1329c1/source/content.js#L35-L60
fregante commentedon Nov 15, 2018
If anyone wants to pick this up:
{ repository(owner: "sindresorhus", name: "refined-github") { collaborators(first: 100) { nodes { login } } } }{ "data": { "repository": { "collaborators": { "nodes": [ { "login": "sindresorhus" }, { "login": "hkdobrev" }, { "login": "SpaceK33z" }, { "login": "kevva" }, { "login": "paulmolluzzo" }, { "login": "busches" }, { "login": "bfred-it" }, { "login": "SamVerschueren" }, { "login": "jgierer12" }, { "login": "DrewML" } ] } } } }