Skip to content

Instantly share code, notes, and snippets.

@harunyardimci
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save harunyardimci/20d08ad82b40e614b228 to your computer and use it in GitHub Desktop.

Select an option

Save harunyardimci/20d08ad82b40e614b228 to your computer and use it in GitHub Desktop.
#!/bin/bash
SUMMARY=$1
DESC=$2
JIRA_URL="http://localhost/rest/api/2/issue/"
JIRA_PROJ="Projectkey"
JIRA_ISSUE_TYPE="Bug"
JIRA_USER="username"
JIRA_PASS="password"
JIRA_KEY=`curl -D- -u ${JIRA_USER}:${JIRA_PASS} -X POST --data "{ \"fields\": { \"project\":{ \"key\": \"${JIRA_PROJ}\" }, \"summary\": \"${SUMMARY}\", \"description\": \"${DESC}\", \"issuetype\": { \"name\": \"${JIRA_ISSUE_TYPE}\" } } }" -H "Content-Type: application/json" ${JIRA_URL} | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep 'key|' | cut -d"|" -f2`
git checkout -b fix/${JIRA_KEY}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment