Skip to content

Instantly share code, notes, and snippets.

@jbinto
Last active November 5, 2021 21:17
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 jbinto/2560339ca89d34e1b55dc043c8b7ee0b to your computer and use it in GitHub Desktop.
Save jbinto/2560339ca89d34e1b55dc043c8b7ee0b to your computer and use it in GitHub Desktop.
mkjira (quickly make JIRA tickets from the command line)

mkjira

Quickly make JIRA tickets from the command line.

Setup

  1. Login to JIRA and create an API token at https://id.atlassian.com/manage-profile/security/api-tokens

  2. Install go-jira:

go install github.com/go-jira/jira/cmd/jira@v1.0.27

(If go is not installed, install it: brew install go)

  1. Ensure your GOPATH is on your shell path. which jira should return something.

If it does not, add the following to your ~/.zshrc:

# GOPATH is usually ~/go on macOS systems.
export PATH=$PATH:~/go/bin
  1. Add the following to your ~/.zshrc and edit the environment variables as necessary.
export JIRA_API_TOKEN=changeme
export JIRA_LOGIN=changeme@example.com
export JIRA_ENDPOINT=https://changeme.atlassian.net
export JIRA_PROJECT=MYPROJ

# example:
# $ mkjira "This is a ticket"
# OK JIRA-123 https://jira.example.org/JIRA-123
mkjira() {
  summary="$@"
  jira create \
    --noedit \
    --issuetype Task \
    --endpoint $JIRA_ENDPOINT \
    --login $JIRA_LOGIN \
    --project $JIRA_PROJECT \
    --override summary="$summary"          
}

Usage

$ mkjira "This is a test"
OK JIRA-123 https://jira.example.org/JIRA-123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment