Last active
July 23, 2017 09:46
-
-
Save kotet/5f864e693ed3388133b64d26915b8ccc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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