Skip to content

Instantly share code, notes, and snippets.

@bitboxer
Last active January 23, 2020 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitboxer/6a9ca7f4b2e1d84c8222b41f9ca75fd5 to your computer and use it in GitHub Desktop.
Save bitboxer/6a9ca7f4b2e1d84c8222b41f9ca75fd5 to your computer and use it in GitHub Desktop.
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