A Github action that will save your developers hours, and company thousands $$$

Look like a good communicator (at least in your pull requests) without having to put down your coffee. The Lazy Linker uses the Jira issue key in your branch name to automatically fill in the title and description of your pull requests on Github.

Look like a good communicator (at least in your pull requests) without having to put down your coffee. The Lazy Linker uses the Jira issue key in your branch name to automatically fill in the title and description of your pull requests on Github.

Example of Pre-filled Pull Request title and description, straight from Jira with The Lazy Linker
Example output

Here's the TLDR for busy people.
Support future content


I'd like to at least pretend I am a decent communicator, perhaps that is just delusion but until the end of this writing allow me to indulge.

As an engineering leader I've had my fair share of code reviews and fell victim to many reviews with sparse details failing to describe what I was attempting to review. Determined to set a precedence and not inflict the same plight on those around me... when I opened a pull request for peer review, I would meticulously name my branches by their Jira issue key, copy over the issue's summary and description, then create a link back to the issue in and place that in the Github description.

While that doesn't sound like a lot, wow is it tedious, especially if you have too-many-tabs syndrome... guilty ✋

According to the Marvelous Suspender browser extension... as of this writing I have 7 windows and 452 tabs open 💀

Well, fast-forward 2 companies, 3 teams, and 3 years and I still hold the same opinion. Making it dead simple for a peer to review your code without having to hunt you down to figure out which issue you worked on is just good ol' neighborly-like behavior.

For those paying close attention, I omitted that I had solved the friction of having to copy-pasta all those issue details from Jira into Github because well...

I hadn't... 😳

Redemption

But that has all changed and recently I authored a Github action which, when opening a Pull Request in Github, will look for a Jira issue key (e.g. UDP-123) in the branch name and pull details about the Jira issue into the Pull Request.

It will use a combination of the Jira issue key plus the summary as the title of the Pull Request. It will also take the description of the Jira issue and prepend it as the description in the Pull Request. (See screen shot above)

Caveats

There is basic support for Markdown syntax coming from Jira. However, most external media e.g. images, user mentions, and links etc. are excluded as they require authorization to view or may be sensitive.

Time and Cost Savings

I love using loose math to support claims, I generally air on the conservative side since the math is imprecise and more illustrative.

Imagine you have a team of 10 software engineers with an average of 7 Pull Requests per month (which I personally think is quite low).

70 Pull Requests / mo

Let's say it takes on average 1 minute to copy and paste over the contents of a Pull Request from Jira, because let's face it, you lost of closed the tab and have to find the issue again.

70 minutes / mo * 12 months = 840 minutes / yr

That's 14 hrs / yr lost in just trying to communicate effectively and speed up the Peer Review process.

According to Glassdoor the median salary for a Software Engineer is $78/hr ($161,487/yr).

💰
That's ~$1,092/yr spent on a tiny fraction of communication

I think it's worth noting here that some skeptics will say...

"well we don't think adding content from Jira to the Pull Request is necessary so we don't waste $1,092/yr".

To this I would say, your lost time and cost is likely MUCH worse than the example above, you're not just measuring it.

Your peers are likely forced to go interrupt each other to get the issue key so they can understand what the hell they're trying to code review, that takes much longer than 1 minute if you consider;

  • Waiting on responses
  • Forgetting which issue it was related to
  • Improperly configured Jira making it hard to find your peer's work
  • If using sprints... Figuring out which issue in the sprint you're trying to peer review

Just to head off the comments I concede the approach mentioned is not for everyone, you can safely stop reading this article and go about your day.

But consider supporting the content before you go 🙃.

Questions

What happens if I don't have a Jira issue key in the branch name?

The action will be skipped and not fail, though you can change this behavior to fail.

If I have two Jira issue key in the branch name will it merge the descriptions

No, first match wins.

Will you ever support merging of multiple descriptions?

No, "Make your requirements less dumb" - Elon Musk.

Consider Giving

This article was written explicitly to save people just like you time, money, and headaches. The easiest way to give back to the community is supporting those willing to put in the work. If you enjoyed this content show your support.

Show Support

TLDR;

Stop wasting time copying and pasting / writing Pull Request titles & descriptions. Let this Github action do it for you instead.

Github Repo: https://github.com/reachtrevor/actions-enrich-pr-with-jira

How to use it

  1. Create a yaml file in your repository in .github/worflows
  2. Name it whatever you want e.g. pr-jira.yml
  3. Add the following workflow definition
  4. Add the required secrets
  5. Save time and party 🎉
name: Jira Lazy Linker

on:
  pull_request:
    types:
      - opened
      - edited

permissions:
  actions: read
  contents: read
  pull-requests: write

jobs:
  jira-lazy-linker:
    name: Jira Lazy Linker
    runs-on: ubuntu-latest

    steps:
      - name: Print to Log
        id: print-to-log
        uses: reachtrevor/actions-the-lazy-linker@v1.3.1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          jira-base-url: ${{ secrets.JIRA_BASE_URL }}
          jira-api-key: ${{ secrets.JIRA_API_KEY }}
          jira-user-email: ${{ secrets.JIRA_USER_EMAIL }}

Subscribe to Reach Trevor

Sign up now to get access to the library of members-only issues.
Jamie Larson
Subscribe