Skip to content

Instantly share code, notes, and snippets.

@alexfu
Last active November 26, 2018 15:55
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 alexfu/2ea6824332ac6c3584ca13357eadcfeb to your computer and use it in GitHub Desktop.
Save alexfu/2ea6824332ac6c3584ca13357eadcfeb to your computer and use it in GitHub Desktop.
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