Created
January 29, 2025 16:01
-
-
Save tvhong/6e530d8a62df996efce0fc6c32ff86d7 to your computer and use it in GitHub Desktop.
Bookmarket to copy GitHub pull request info to your clipboard
This file contains hidden or 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
javascript:(function(){ | |
try { | |
const url = window.location.href; | |
const title = document.querySelector('.js-issue-title').innerText; | |
const author = document.querySelector ('.author').innerText; | |
const filesChanged = document.querySelector('#files_tab_counter').innerText; | |
const diffStats = document.querySelector('.diffstat').innerText.trim(); | |
const formattedText = `Title: ${title}\n | |
Author: ${author}\n | |
URL: ${url}\n | |
Files changed: ${filesChanged}\n | |
Changes: ${diffStats}`; | |
document.activeElement.focus(); /* need this so clipboard works reliably */ | |
navigator.clipboard.writeText(formattedText); | |
} catch(e) { | |
alert('Error: Make sure you are on a GitHub PR page'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment