Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Better Slack PR messages

After reading this blogpost by Thoughtbot I got the idea to implement a simple bookmarklet to help me create these beautiful PR messages in slack.

If you want it, too, simply create a bookmark with the following Javascript as link:

javascript: (function() {const diffStat = document.getElementById("diffstat").textContent.replace(/(\r\n\t|\n|\r\t)/gm,"").trim().replace(/\s\s+/g, ' ');  window.prompt("Copy this", ":pullrequest: " + window.location.toString() + " " + diffStat);})();

Navigate to a GitHub PR and click on the bookmark. You will see a messagebox where you can copy the text and paste it into your slack. Sadly Firefox permissions won't allow us to copy the text directly into the clipboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.