34 lines
676 B
Bash
Executable File
34 lines
676 B
Bash
Executable File
#! /bin/bash
|
|
|
|
set -e
|
|
set -u
|
|
set -o pipefail
|
|
|
|
|
|
configFile=~/.gitapi
|
|
|
|
test -r $configFile || {
|
|
echo "gimme a $configFile with username, password and serverUrl correctly set"
|
|
exit 1
|
|
}
|
|
|
|
source $configFile
|
|
|
|
url=${server}/api/v1/repos/$user/${repo}///issues
|
|
|
|
if [ $# -gt 0 ] ; then
|
|
customer=$1
|
|
title=$2
|
|
text=$3
|
|
else
|
|
read -p "customer: " customer
|
|
read -p "title: " title
|
|
read -p "text - use \\n for multiline " text
|
|
fi
|
|
|
|
data="{ \"title\": \"$customer $title\",\"state\": \"open\",\"body\": \"$text\"}"
|
|
echo "$data"
|
|
|
|
curl -H "Authorization: Bearer ${token}" "${url}" -X POST -H 'Content-Type: application/json' -d "$data"
|
|
|
|
[ $? -eq 0 ] && { echo issue created ; } |