Created
January 26, 2018 00:10
-
-
Save kenazk/8e55687d0e22a1374a7320dc517d5a81 to your computer and use it in GitHub Desktop.
JIRA CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
endpoint: https://tickets.puppetlabs.com | |
user: kenaz | |
project: DI | |
editor: vim | |
custom-commands: | |
- name: env | |
help: print the JIRA environment variables available to custom commands | |
script: | | |
env | grep JIRA | |
- name: mine | |
help: display issues assigned to me | |
script: |- | |
echo $1 | |
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 status desc" | |
else | |
# otherwise list issues for all project | |
echo "\"project: ...\" configuration missing from .jira.d/config.yml" | |
fi | |
- name: team | |
help: display issues in the current sprint for [dp, pdp, ss, ie] team | |
options: | |
- name: name | |
type: ENUM | |
enum: | |
- dp | |
- pdp | |
- ss | |
- ie | |
required: true | |
script: |- | |
if [[ {{options.name}} == "dp" ]]; then | |
{{jira}} list --template table --query "project = DI and sprint in openSprints() and team = 'Discovery Pipeline' ORDER BY status desc" | |
elif [[ {{options.name}} == "pdp" ]]; then | |
{{jira}} list --template table --query "project = DI and sprint in openSprints() and team = 'Data Platform' ORDER BY status desc" | |
elif [[ {{options.name}} == "ie" ]]; then | |
{{jira}} list --template table --query "project = DI and sprint in openSprints() and team = 'Insights Experiences' ORDER BY status desc" | |
elif [[ {{options.name}} == "ss" ]]; then | |
{{jira}} list --template table --query "project = DI and sprint in openSprints() and team = 'Shared Services' ORDER BY status desc" | |
else | |
# otherwise list issues for all project | |
{{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() ORDER BY priority asc, created" | |
fi | |
- name: transition-issues | |
help: Transition multiple issues to a provided state | |
args: | |
- name: state | |
required: true | |
- name: issue | |
required: true | |
repeat: true | |
script: |- | |
issues=({{range $issues := args.issue}}{{$issues}} {{end}}); | |
for i in "${issues[@]}" | |
do | |
{{jira}} transition {{args.state}} $i --noedit | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment