Skip to content

Instantly share code, notes, and snippets.

@jlangridge
Last active August 9, 2018 06:34
Show Gist options
  • Save jlangridge/3879107 to your computer and use it in GitHub Desktop.
Save jlangridge/3879107 to your computer and use it in GitHub Desktop.
Short script to update jira and branch for new issues
#!/bin/sh
#Requires Jira CLI, from https://marketplace.atlassian.com/download/plugins/org.swift.atlassian.cli/version/110
JIRAUSER=[Username]
JIRAPASSWORD=******
JIRASERVER=http://[Jira address]
DEVELOPMENT_HOME=[Git repo (local)]
JIRA_CLI_HOME=/c/Atlassian/jira-cli-3.0.0
function callJira {
java -jar $JIRA_CLI_HOME/lib/jira-cli-3.0.0.jar --server $JIRASERVER --user $JIRAUSER --password $JIRAPASSWORD "$@"
}
if [ -z "$1" ]
then
echo Usage: begin [ticket number];
exit 1;
fi
echo "Assigning $1 to $JIRAUSER..."
callJira --action updateIssue --assignee "$JIRAUSER" --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
#!/bin/bash
#Requires Jira CLI, from https://marketplace.atlassian.com/download/plugins/org.swift.atlassian.cli/version/110
JIRAUSER=`security find-internet-password -gs powerplant.nature.com 2>&1 | grep acct | cut -d = -f 2 | awk -F'"' '{ print $2 }'`
JIRAPASSWORD=`security find-internet-password -gs powerplant.nature.com 2>&1 | grep password | cut -d : -f 2 | awk -F'"' '{ print $2 }'`
JIRASERVER=http://powerplant.nature.com/jira
DEVELOPMENT_HOME=~/Work/osmium
JIRA_CLI_HOME=/Applications/jira-cli-3.4.0
function callJira {
java -jar $JIRA_CLI_HOME/lib/jira-cli-3.4.0.jar --server $JIRASERVER --user $JIRAUSER --password $JIRAPASSWORD "$@"
}
if [ -z "$1" ]
then
echo Usage: begin [ticket number];
exit 1;
fi
echo "Assigning $1 to $JIRAUSER..."
callJira --action updateIssue --assignee "$JIRAUSER" --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 master
popd
@macdermott
Copy link

REJECTED.

Wait, what?

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