Skip to content

Instantly share code, notes, and snippets.

@kotet
Last active July 23, 2017 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kotet/5f864e693ed3388133b64d26915b8ccc to your computer and use it in GitHub Desktop.
Save kotet/5f864e693ed3388133b64d26915b8ccc to your computer and use it in GitHub Desktop.
json=$(curl -s --header "PRIVATE-TOKEN: $REPORT_GENERATOR_TOKEN" https://gitlab.com/api/v4/projects/$PROJECT_ID/issues?state=opened)
len=$(echo $json | jq length)
echo '<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body>'
echo "<h1>" $(date) "</h1>"
for i in $( seq 0 $(($len - 1)) ); do
item=$(echo $json | jq ".[$i]")
title=$(echo $item | jq ".title")
description=$(echo $item | jq ".description")
all=$(echo -e $description | grep -c "\[.\]")
complete=$(echo -e $description | grep -c "[x]")
if [ ! $all = "0" ]; then
ratio=$(echo "scale=2; $complete/$all" | bc | tail -c 3)
echo "<h3>" $(echo $title | tr -d '"') "</h3>"
if [ $all = $complete ]; then
echo "<p>completed!</p>"
else
echo "<p>" $complete "/" $all "(" $ratio "%)" "</p>"
fi
fi
done
echo "</body>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment