Skip to content

Instantly share code, notes, and snippets.

@alexfu
Last active Nov 26, 2018
Embed
What would you like to do?
Creating GitHub PRs directly from JIRA tickets

Creating GitHub PRs directly from JIRA tickets

With a single command, you will be able to create a GitHub pull request from a JIRA ticket.

git jira-pr -t BUY-123 -b development

The above command will fetch the JIRA ticket and create a pull request using the JIRA ticket ID and summary as the pull request title.

Setup

  1. Obtain GitHub access token: https://github.com/settings/tokens
  2. Obtain JIRA access token: https://id.atlassian.com/manage/api-tokens
  3. Download & install github-jira-pr command line tool

Create custom jira-pr git command

  1. Create a jira-pr file with the following contents:
#!/bin/bash

github-jira-pr \
--github-access-token <INSERT YOUR GITHUB ACCESS TOKEN> \
--jira-access-token <INSERT YOUR JIRA ACCESS TOKEN> \
--jira-email <INSERT YOUR JIRA EMAIL> \
--jira-host <INSERT YOUR JIRA HOST> \
"$@"
  1. Make it executable: chmod +x jira-pra
  2. Store it in a safe place and make sure it's in your PATH. I like to use ~/.git/bin

You are now able to create PRs directly from JIRA tickets by using the following command on a GitHub repo:

git jira-pr -t BUY-123 -b development
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment