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
I made a Chrome extension, called Potential changes, as a proof of concept for this feature. Right now it's pretty limited and rough but I'm quite happy with the result :)
@bfred-it That query looks awesome! It will greatly simplify things compared to what I'm doing now. Essentially, replacing multiple requests with just one. Nice :)
I'm aware of v4 of the API but haven't explored it more because, besides the custom header, it also requires an OAuth token. I will definitely try this option in the future.
Version 4 of the API is now used often here, so I feel this can be implemented. But before I start working on this (would like to), how should this be implemented?
Here a few possible solutions:
Solution 1 - one call per repo
One call when opening the repo (or blob page) for the first time. Cache the data for a limited time. When an blob page is opened, the cached data will be checked for usage.
Pros
Only one call required for the whole repo.
Can be beautifully integrated in the design.
Cons
PRs change fast. Cached data is invalid quickly.
New PRs can be created anytime. Cached data is not adaptive to new PRs.
Solution 2 - call-to-action
The query is only called when the user manually requests it. E.g. by clicking an button (just like above mentioned "Potential changes") on an blob page.
Pros
No unneeded API call. Only calls the query when requested.
Cons
Requires an user action, fetching time and processing time, before it's visible to the user that the file is being used in an PR.
Requires a visual actionable button, instead of an list of PR ids visual integrated in the design.
Solution 3 - ???
Any better suggestions...
The assumption is that this should at least be implemented on blob pages. But also on edit pages? Or on the tree?
How would we visually show that a file is being used in an PR? Maybe the same way as we do with issues linked in PR (e.g. #1197Closed in #2102 label).
Activity
fregante commentedon May 14, 2018
I wish it was possible, but I don't think there's an API for that.
[-]list opened PRs touching displayed file[/-][+]List opened PRs touching displayed file[/+]sindresorhus commentedon Nov 7, 2018
This would be super useful, but I don't think it's possible. Keeping this open though, as I would like to be proven wrong!
For anyone that wants this, please also send this feature request to GitHub: [email protected]
dzhavat commentedon Dec 19, 2018
I made a Chrome extension, called Potential changes, as a proof of concept for this feature. Right now it's pretty limited and rough but I'm quite happy with the result :)
I've also open sourced the code for anyone interested.
fregante commentedon Dec 20, 2018
{ repository(owner: "sindresorhus", name: "refined-github") { pullRequests(first: 100, states: OPEN) { nodes { files(first: 100) { nodes { path } } } } } }JSON output
{ "data": { "repository": { "pullRequests": { "nodes": [ { "files": { "nodes": [ { "path": "readme.md" }, { "path": "source/content.js" }, { "path": "source/features/add-closed-milestone-due-date.js" }, { "path": "source/libs/graph.js" }, { "path": "source/libs/icons.js" }, { "path": "source/libs/page-detect.js" } ] } }, { "files": { "nodes": [ { "path": "source/content.js" }, { "path": "source/features/add-star-repo-hotkey.js" } ] } }, { "files": { "nodes": [ { "path": "source/content.css" }, { "path": "source/features/add-diff-view-without-whitespace-option.js" }, { "path": "source/features/add-profile-hotkey.js" }, { "path": "source/features/add-releases-tab.js" }, { "path": "source/features/add-trending-menu-item.js" }, { "path": "source/features/improve-shortcut-help.js" } ] } }, { "files": { "nodes": [ { "path": "source/content.js" }, { "path": "source/features/add-pr-branches.js" }, { "path": "source/libs/page-detect.js" }, { "path": "test/page-detect.js" } ] } }, { "files": { "nodes": [ { "path": "source/features/fix-squash-and-merge-title.js" } ] } }, { "files": { "nodes": [ { "path": "source/content.js" }, { "path": "source/features/extend-file-types-filter.js" } ] } }, { "files": { "nodes": [ { "path": "source/features/mark-unread.js" } ] } } ] } } } }You can use the API v4 to get 100 PRs × 100 files at once, but for now it's in preview/beta mode, you need a custom header:
Accept: application/vnd.github.ocelot-preview+jsondzhavat commentedon Dec 20, 2018
@bfred-it That query looks awesome! It will greatly simplify things compared to what I'm doing now. Essentially, replacing multiple requests with just one. Nice :)
I'm aware of v4 of the API but haven't explored it more because, besides the custom header, it also requires an OAuth token. I will definitely try this option in the future.
IssueHuntBot commentedon May 30, 2019
@IssueHunt has funded $60.00 to this issue.
jerone commentedon Jun 4, 2019
Version 4 of the API is now used often here, so I feel this can be implemented. But before I start working on this (would like to), how should this be implemented?
Here a few possible solutions:
Solution 1 - one call per repo
One call when opening the repo (or blob page) for the first time. Cache the data for a limited time. When an blob page is opened, the cached data will be checked for usage.
Pros
Cons
Solution 2 - call-to-action
The query is only called when the user manually requests it. E.g. by clicking an button (just like above mentioned "Potential changes") on an blob page.
Pros
Cons
Solution 3 - ???
Any better suggestions...
The assumption is that this should at least be implemented on blob pages. But also on edit pages? Or on the tree?
How would we visually show that a file is being used in an PR? Maybe the same way as we do with issues linked in PR (e.g. #1197 Closed in #2102 label).
Should we actually cache the data?
Query (small change):
{ repository(owner: "sindresorhus", name: "refined-github") { pullRequests(first: 100, states: OPEN) { nodes { permalink files(first: 100) { nodes { path } } } } } }jerone commentedon Jun 13, 2019
Let's first discuss where this should be implemented?:
My preference are going to blob & edit pages.
fregante commentedon Jun 27, 2019
Solution 1 sounds good: trigger call when on blob/edit pages
1- or 2-day caching is ok I think.
jerone commentedon Jun 27, 2019
I want to give this a try.
issuehunt-oss commentedon Nov 3, 2019
@sindresorhus has rewarded $54.00 to @jerone. See it on IssueHunt