Last active
October 26, 2023 17:59
-
-
Save ericboehs/2a38ab9696edfc6a192162386373a1fd to your computer and use it in GitHub Desktop.
Redirects ZenHub links to GitHub Issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ZenHub to GitHub Redirect | |
// @namespace boehs.com | |
// @include *://app.zenhub.com/* | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
(() => { | |
const regex = /https:\/\/app\.zenhub\.com\/workspaces\/.+\/issues\/gh\/(.+\/.+?)\/(\d+)$/; | |
const input = window.location.href; | |
const match = input.match(regex); | |
if (match) { | |
const orgRepo = match[1]; | |
const issueNumber = match[2]; | |
console.log("oRepo:" +orgRepo); | |
console.log("i#:" + issueNumber) | |
const url = `https://github.com/${orgRepo}/issues/${issueNumber}`; | |
console.log("Referer: " + document.referrer); | |
if (document.referrer != "https://github.com/") | |
window.location.replace(url); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also: Add a sidebar link to GitHub issues to redirect you to ZenHub.