Skip to content

Instantly share code, notes, and snippets.

@mabroor
Created October 28, 2020 20:01
Show Gist options
  • Save mabroor/3ecf77d35c38107dce0e364f1f201f1a to your computer and use it in GitHub Desktop.
Save mabroor/3ecf77d35c38107dce0e364f1f201f1a to your computer and use it in GitHub Desktop.
Getting started with go-jira

Getting Jira on CLI

The instructions on the Go Jira are not so good on how to get started so I have created this guide to get up and running.

For MacOS

brew install go-jira

Once installed you will need a config.yml in ~/.jira.d

The docs don't explain the basic settings needed for a hosted JIRA platform.

Use the following:

endpoint: https://COMPANY.atlassian.net
user: USERNAME
login: [email protected]
password-source: keyring

project: PROJECTCODE

custom-commands:
  - name: mine
    help: display issues assigned to me
    script: |-
      if [ -n "$JIRA_PROJECT" ]; then
          # if `project: ...` configured just list the issues for current project
          {{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() and project = $JIRA_PROJECT ORDER BY priority asc, created"
      else
          # otherwise list issues for all project
          {{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() ORDER BY priority asc, created"
      fi
  - name: sprint
    help: display issues for active sprint
    script: |-
      if [ -n "$JIRA_PROJECT" ]; then
          # if `project: ...` configured just list the issues for current project
          {{jira}} list --template table --query "sprint in openSprints() and type != epic and resolution = unresolved and project=$JIRA_PROJECT ORDER BY rank asc, created"
      else
          # otherwise list issues for all project
          {{jira}} list --template table --query "sprint in openSprints() and type != epic and resolution = unresolved ORDER BY rank asc, created"
      fi

I have also pasted some useful custom commands copied from the docs.

You will need a JIRA token and then run:

jira session

Have a look at the project docs for other useful commands but this should get you started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment