šŸ”„ Using code to write code: Exporting issues with a Bookmarklet

September 28, 2020 (Syndicated From dev.to)

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. šŸ„