Skip to content

Instantly share code, notes, and snippets.

@jlangridge
Last active December 14, 2015 20:19
Show Gist options
  • Save jlangridge/5142969 to your computer and use it in GitHub Desktop.
Save jlangridge/5142969 to your computer and use it in GitHub Desktop.
Small shell script to automate jira ticket management
#!/bin/bash
#Requires Jira Cli (https://marketplace.atlassian.com/plugins/org.swift.jira.cli)
#and JIRA_USER, JIRA_PASSWORD, JIRA_SERVER and DEVELOPMENT_HOME
#to be set
JIRA_CLI_HOME=/c/Atlassian/jira-cli-3.0.0
echo $JIRA_CLI_HOME
function callJira {
java -jar $JIRA_CLI_HOME/lib/jira-cli-3.0.0.jar --server $JIRA_SERVER --user $JIRA_USER --password $JIRA_PASSWORD "$@"
}
if [ -z "$1" ]
then
echo Usage: begin [ticket number];
exit 1;
fi
echo "Assigning $1 to $JIRA_USER..."
callJira --action updateIssue --assignee "$JIRA_USER" --issue "$1"
echo "Marking $1 as in progress..."
callJira --action progressIssue --issue "$1" --step "4"
SUMMARY=$(callJira --action getFieldValue --issue "$1" --field "summary" --quiet | sed 's/ /_/g')
echo $1_$SUMMARY
read -e -p "Name of new branch to create (default: $1_$SUMMARY):" BRANCHNAME
if [ -z "$BRANCHNAME"]
then
BRANCHNAME=$1_$SUMMARY
fi
pushd $DEVELOPMENT_HOME
git checkout -b $BRANCHNAME
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment