How do I get from the dashboard to the GitHub view...
# how-do-i
v
How do I get from the dashboard to the GitHub view of the PR?
j
you can use the shortcut "G L" to copy the link to the GitHub URL to your clipboard
v
Sneaky, some questions for that: • that's not too convenient, is there not way to go to GH directly? • is it a bug or intended that this shortcut is not shown in the shortcut help?
j
We link specifically to GitHub for some of the features that we don't yet show on the site, e.g. specific CI runs, raw files — it should show up in the shortcut help though! I'll fix that
v
In return,
G A
is shown but does not work
Pressing it just toggles the general info
j
are you talking about this? I see the correct shortcut there
v
Oh, missed the scrollbar, sorry 😄
Hm, no, I did not miss the scrollbar, I just didn't see it. Maybe because I expected it at the other
G then
shortcuts
d
can you say more about why you're hoping to jump to the Github view, just to get a better sense of what you wanted to do?
v
Hm, no, there are suddenly more shortcuts that were not there before when I looked at the help some minutes ago
j
Maybe because I expected it at the other G then shortcuts
yeah, they're sorted by page — that shortcut only works on the PR page so it's down there
v
jump to next/previous thread and view upstack/downstack pull requests were also not there
can you say more about why you're hoping to jump to the Github view, just to get a better sense of what you wanted to do?
Not trusting Graphite yet (or maybe ever :-D) The canonical thing is still GitHub.
d
anything specific you don't trust? (this helps us think about things to build or fix next 🙂 )
v
I'm a very sceptic person. 😄 Besides that, what I reported in #bug-reports 🙂
c
Yeah +1, I’ve seen this requested a bunch. I pretty much always look at the GitHub view of the PR before merging because merging code has risks, and I’ve been using the GitHub interface for years, so I think there are things that I could catch there that I wouldn’t catch from Graphite. Even if Graphite is perfect, I don’t know that yet, and need time to build confidence in it. I also want to know what my coworkers who don’t use Graphite are going to see It seems like the web app is (somewhat understandably) designed to discourage using GitHub directly, but nevertheless it’s so important to me I will always work around it. I uninstalled the redirecting web extension and have just habituated the multiclick workflow — open triple dot menu, click copy link to GitHub button, new tab, paste, enter IMO there should just be a single click button. I promise it won’t stop me from using Graphite!
j
Even though it won't stop you from using Graphite, we prefer to add a little bit of friction to the subconscious "oh, I'll just use GH" because we believe that in the long run we'll be able to collect better feedback about improving the Graphite code review experience. It's definitely something we are not doing lightly
We believe that this will help us create the best product possible
I know it's annoying — even we want to look at the PR on GH sometimes!
fwiw, the chrome extension no longer automatically redirects you to Graphite, the latest version now adds a "View in Graphite" button to the GH page instead
v
Then the description needs to be updated. At least yesterday it still said it auto-redirects
Actually, a similar extension could be done for the reverse way, or could even be as simple as a user script that injects that option. :-)
And there we have it 🙂
Copy code
// ==UserScript==
// @name          Graphite -> GitHub
// @description	  Injects a button to go to GitHub PR page from Graphite PR details
// @author        Björn Kautler
// @version       1.0
// @match         <https://app.graphite.dev/*>
// @require       <https://code.jquery.com/jquery-3.7.0.slim.min.js>
// ==/UserScript==

(function() {

let observer = new MutationObserver((mutations) => {
    if ($(".pull-request").length == 0) return
    if ($("#go-to-github").length != 0) return
    $(".header__nav").prepend('<button id="go-to-github" type="submit" class="buttons__button buttons__button__style--solid buttons__button__size--default" style="margin-right: 5px; background-color: gray"><img src="<https://github.githubassets.com/pinned-octocat.svg>" width="100%" height="100%"/></button>')

    $("#go-to-github").click(() => {
        window.open(window.location.href.replace(/^https:\/\/app.graphite.dev\/github\/pr\/([^\/]+)\/([^\/]+)\/([^\/]+)(\/.*)?$/, '<https://github.com/$1/$2/pull/$3>'), '_blank')
        return false
    })
})
observer.observe(document.body, { childList: true, subtree: true, attributes: false, characterData: false })

})();
chrome_fsiOm6XHSw.gif
❤️ 1
😮 1
Here a better version that does not almost completely hide the search bar I was not aware of. Editing my post somehow does not work.
Copy code
// ==UserScript==
// @name          Graphite -> GitHub
// @description	  Injects a button to go to GitHub PR page from Graphite PR details
// @author        Björn Kautler
// @version       1.1
// @match         <https://app.graphite.dev/*>
// @require       <https://code.jquery.com/jquery-3.7.0.slim.min.js>
// ==/UserScript==

(function() {

let observer = new MutationObserver((mutations) => {
    if ($(".pull-request").length == 0) return
    if ($("#go-to-github").length != 0) return
    $(".header__nav").prepend('<button id="go-to-github" type="submit" class="buttons__button buttons__button__style--solid buttons__button__size--default" style="margin-right: 5px; background-color: gray; width: unset"><img src="<https://github.githubassets.com/pinned-octocat.svg>" width="100%" height="100%"/></button>')

    $("#go-to-github").click(() => {
        window.open(window.location.href.replace(/^https:\/\/app.graphite.dev\/github\/pr\/([^\/]+)\/([^\/]+)\/([^\/]+)(\/.*)?$/, '<https://github.com/$1/$2/pull/$3>'), '_blank')
        return false
    })
})
observer.observe(document.body, { childList: true, subtree: true, attributes: false, characterData: false })

})();
❤️ 1
Here an updated version, working with latest dashboard. The button does not blend in as nicely, as the button classes were renamed and I do not use them anymore to be more future-proof:
Copy code
// ==UserScript==
// @name          Graphite -> GitHub
// @description	  Injects a button to go to GitHub PR page from Graphite PR details
// @author        Björn Kautler
// @version       1.2
// @match         <https://app.graphite.dev/*>
// @require       <https://code.jquery.com/jquery-3.7.0.slim.min.js>
// ==/UserScript==

(function() {

let observer = new MutationObserver((mutations) => {
    if ($(".pull-request__description").length == 0) return
    if ($("#go-to-github").length != 0) return
    $(".header__nav").prepend('<button id="go-to-github" type="submit" style="margin-right: 5px; background-color: gray"><img src="<https://github.githubassets.com/pinned-octocat.svg>" width="16" height="16"/></button>')

    $("#go-to-github").click(() => {
        window.open(window.location.href.replace(/^https:\/\/app.graphite.dev\/github\/pr\/([^\/]+)\/([^\/]+)\/([^\/]+)(\/.*)?$/, '<https://github.com/$1/$2/pull/$3>'), '_blank')
        return false
    })
})
observer.observe(document.body, { childList: true, subtree: true, attributes: false, characterData: false })

})();
❤️ 1
v
.
v
Here again an updated version, adapted to latest dashboard:
Copy code
// ==UserScript==
// @name          Graphite -> GitHub
// @description	  Injects a button to go to GitHub PR page from Graphite PR details
// @author        Björn Kautler
// @version       1.3
// @match         <https://app.graphite.dev/*>
// @require       <https://code.jquery.com/jquery-3.7.0.slim.min.js>
// ==/UserScript==

(function() {

let observer = new MutationObserver((mutations) => {
    if ($("[data-testid='pull-request-description']").lentgh == 0) return
    if ($("#go-to-github").length != 0) return
    $(".dropdown-anchor").prepend('<button id="go-to-github" type="submit" style="margin-right: 5px; background-color: gray"><img src="<https://github.githubassets.com/pinned-octocat.svg>" width="16" height="16"/></button>')

    $("#go-to-github").click(() => {
        window.open(window.location.href.replace(/^https:\/\/app.graphite.dev\/github\/pr\/([^\/]+)\/([^\/]+)\/([^\/]+)(\/.*)?$/, '<https://github.com/$1/$2/pull/$3>'), '_blank')
        return false
    })
})
observer.observe(document.body, { childList: true, subtree: true, attributes: false, characterData: false })

})();
c
most well-maintained random userscript award 🏆
🎉 1