Skip to content

Instantly share code, notes, and snippets.

@ericboehs
Last active October 26, 2023 17:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericboehs/2a38ab9696edfc6a192162386373a1fd to your computer and use it in GitHub Desktop.
Save ericboehs/2a38ab9696edfc6a192162386373a1fd to your computer and use it in GitHub Desktop.
Redirects ZenHub links to GitHub Issues
// ==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);
}
})();
@ericboehs
Copy link
Author

For Userscripts in Safari. May work in Tampermonkey or other user script extensions in Chrome/FF.

Screenshot.2023-04-13.at.12.58.52.mp4

@ericboehs
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment