Skip to content

Instantly share code, notes, and snippets.

@vangie
Created March 2, 2020 02:31
Show Gist options
  • Save vangie/3cb38d26bb8f26dde32c4e560941c9df to your computer and use it in GitHub Desktop.
Save vangie/3cb38d26bb8f26dde32c4e560941c9df to your computer and use it in GitHub Desktop.
github issue 统计
#!/bin/bash
REPO=alibaba/serverless-vscode
URL=https://api.github.com/search/issues
DATE=2019-10-07
count_issue(){
n=0
until [ $n -ge 5 ]
do
count=`curl -s "$URL?q=is:issue+repo:$REPO+$1" | jq '.total_count' | tr -d '\n'`
if [ $count != "null" ] ; then
break
fi
n=$[$n+1]
sleep 3
done
echo -n "$count"
}
for i in `seq 0 7 150`
do
NEXT_DATE=$(date -v+${i}d -ujf"%Y-%m-%d" $DATE +%Y-%m-%d)
END_DATE=$(date -v-1d -ujf"%Y-%m-%d" $NEXT_DATE +%Y-%m-%d)
START_DATE=$(date -v-8d -ujf"%Y-%m-%d" $NEXT_DATE +%Y-%m-%d)
echo -n "$NEXT_DATE "
#curl -s "$URL?q=is:issue+repo:$REPO+is:open+created:<$NEXT_DATE" | jq '.total_count' | tr -d '\n'
count_issue "is:open+created:<$NEXT_DATE"
sleep 3
echo -en "\t"
count_issue "created:<$NEXT_DATE+closed:>$END_DATE"
#curl -s "$URL?q=is:issue+repo:$REPO+created:<$NEXT_DATE+closed:>$END_DATE" | jq '.total_count' | tr -d '\n'
sleep 3
echo -en "\t"
count_issue "created:<$NEXT_DATE+closed:${START_DATE}..${END_DATE}"
#curl -s "$URL?q=is:issue+repo:$REPO+created:<$NEXT_DATE+closed:${START_DATE}..${END_DATE}" | jq '.total_count'
sleep 3
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment