Thomas Reggi's Profile Image

@thomasreggi 🌸

🔄 Using code to write code: Exporting issues with a Bookmarklet

September 28, 2020 (Syndicated From

Cover Image

When I started back in March at MongoDB I wanted an easy way to create a list of what I was working on.

There are two main pages I need to check on a daily basis:

These two lists show me the main “docket” for the day, and the tickets I need to shepherd.

What I found was that I had to often make lists of these things I’m working on. Between GitHub and Jira things can be a little scattered, there’s the reviews I’m doing, reviews I need to request from my fellow colleagues, draft pull requests, and tickets that are assigned to me that don’t yet have a PR associated.

These lists ideally would both have a reference to GitHub and Jira. I wanted a way to copy all the links and put them in one place.

What I quickly thought of was creating a simple bookmarklet that would select all the tickets from the DOM.

View the source at this gist: reggi/github-link-bookmarklet.js

Because the links are in markdown it isn’t super easy to paste into Slack or a Google doc. What I normally do is render the markdown and then copy the outputted list into slack, which is an unfortunate extra step.

I’ve been using a chrome extension Bookmarkletifier to make incremental changes and maintain the script, it’s not great and can create malformed JavaScript, which doesn’t matter in the editor because it all gets minified. I haven’t found a better workflow for maintain or writing bookmarklets, I’m curious if anyone has any advice out there.

The script has a useful feature where it can parse the Jira ticket from the pull request and adding a specific link to the ticket. There are some hardcoded things in the script that appeal to my use case, but feel free to rewire it to suit your needs. 🤙🐍

There you have it! Problem solved, everything is a little easier to manage. I hope this inspires other developers not to be afraid to spend a little extra time to write a script that will help them in the long run. Happy coding. 🏄