Skip to content

Instantly share code, notes, and snippets.

@lehmacdj
Created March 28, 2025 18:44
Show Gist options
  • Save lehmacdj/665fa643df39dc9faae32b1ef1bebf7b to your computer and use it in GitHub Desktop.
Save lehmacdj/665fa643df39dc9faae32b1ef1bebf7b to your computer and use it in GitHub Desktop.
Duolingo Github to Graphite Redirect
// ==UserScript==
// @name Github PR to Graphite Redirect
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Redirect GitHub PR pages to Graphite equivalents
// @match https://github.com/duolingo/*/pull/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
const githubUrl = window.location.href;
// Match pattern: https://github.com/{owner}/{repo}/pull/{number}
const match = githubUrl.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/);
if (match) {
const [, owner, repo, prNumber] = match;
if (owner != "duolingo") {
return;
}
const graphiteUrl = `https://app.graphite.dev/github/pr/${owner}/${repo}/${prNumber}`;
window.location.replace(graphiteUrl);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment