mirror of
https://github.com/tonydamage/nux-env.git
synced 2025-12-11 13:24:28 +01:00
taskie: Fixed github add issue
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
parent
cceebef784
commit
c1f365db70
3 changed files with 26 additions and 16 deletions
|
|
@ -2,5 +2,7 @@ backends:
|
||||||
preference: gogs github
|
preference: gogs github
|
||||||
colors:
|
colors:
|
||||||
labels:
|
labels:
|
||||||
bug: red
|
bug: bg_red
|
||||||
enhancement: blue
|
enhancement: blue
|
||||||
|
state:
|
||||||
|
open: bg_green
|
||||||
|
|
|
||||||
|
|
@ -30,3 +30,8 @@ backend.github.detect() {
|
||||||
echo $repo:$closest_git
|
echo $repo:$closest_git
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backend.github.labels.id() {
|
||||||
|
githublike.get "labels" \
|
||||||
|
| jq -r ".[] | .name + \":\" + .name"
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,12 @@ githublike.common.issue.list() {
|
||||||
|
|
||||||
githublike.common.issue.exists() {
|
githublike.common.issue.exists() {
|
||||||
local message="$@"
|
local message="$@"
|
||||||
nux.json.start
|
id="null"
|
||||||
nux.json.open "$githublike_issuemap"
|
if [ -e "$githublike_issuemap" ]; then
|
||||||
id=$(nux.json.read "\"$githublike_api\".\"$githublike_repository\".\"$message\"")
|
nux.json.start
|
||||||
|
nux.json.open "$githublike_issuemap"
|
||||||
|
id=$(nux.json.read "\"$githublike_api\".\"$githublike_repository\".\"$message\"")
|
||||||
|
fi
|
||||||
nux.log debug "Message Id is $id"
|
nux.log debug "Message Id is $id"
|
||||||
test "$id" != null #-o -n "$id";
|
test "$id" != null #-o -n "$id";
|
||||||
}
|
}
|
||||||
|
|
@ -29,8 +32,8 @@ githublike.common.issue.add() {
|
||||||
|
|
||||||
nux.json.write title "$message"
|
nux.json.write title "$message"
|
||||||
nux.json.write message "$message"
|
nux.json.write message "$message"
|
||||||
if [ -n "labelId" ]; then
|
if [ -n "$labelId" ]; then
|
||||||
nux.json.write.raw labels[0] $labelId
|
nux.json.write labels[0] $labelId
|
||||||
fi
|
fi
|
||||||
local payload=$(nux.json.flush)
|
local payload=$(nux.json.flush)
|
||||||
|
|
||||||
|
|
@ -58,16 +61,15 @@ githublike.get() {
|
||||||
nux.log debug Repository is $githublike_repository, message is $message
|
nux.log debug Repository is $githublike_repository, message is $message
|
||||||
nux.log debug API call: $api Payload: $payload
|
nux.log debug API call: $api Payload: $payload
|
||||||
header_tmp=$(mktemp);
|
header_tmp=$(mktemp);
|
||||||
while [ -n "$api" ];
|
while [ -n "$api" ]; do
|
||||||
do
|
curl $githublike_curl_params -s -D "$header_tmp" -H "Content-Type: application/json" "$api"
|
||||||
curl $githublike_curl_params -s -D "$header_tmp" -H "Content-Type: application/json" "$api"
|
next=$(grep "Link: " "$header_tmp" | tr "," "\n" | grep rel=\"next\" | cut -d"<" -f2 | cut -d">" -f1)
|
||||||
next=$(grep "Link: " "$header_tmp" | tr "," "\n" | grep rel=\"next\" | cut -d"<" -f2 | cut -d">" -f1)
|
nux.log debug Next "$next";
|
||||||
nux.log debug Next "$next";
|
if [ -n "$next" ]; then
|
||||||
if [ -n "$next" ]; then
|
api="${next}${githublike_next_append}"
|
||||||
api="${next}${githublike_next_append}"
|
else
|
||||||
else
|
api=""
|
||||||
api=""
|
fi
|
||||||
fi
|
|
||||||
done;
|
done;
|
||||||
rm -f $header_tmp;
|
rm -f $header_tmp;
|
||||||
}
|
}
|
||||||
|
|
@ -77,6 +79,7 @@ githublike.post() {
|
||||||
local api="${githublike_api}/repos/${githublike_repository}/${resource}${githublike_api_append}"
|
local api="${githublike_api}/repos/${githublike_repository}/${resource}${githublike_api_append}"
|
||||||
local payload="$2"
|
local payload="$2"
|
||||||
nux.log debug POST API call: $api Payload: $payload
|
nux.log debug POST API call: $api Payload: $payload
|
||||||
|
nux.log trace curl $githublike_curl_params -s -H "Content-Type: application/json" -X POST -d "$payload" "$api"
|
||||||
curl $githublike_curl_params -s -H "Content-Type: application/json" -X POST -d "$payload" "$api"
|
curl $githublike_curl_params -s -H "Content-Type: application/json" -X POST -d "$payload" "$api"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue