Created
February 7, 2018 22:05
-
-
Save knbknb/c068f3966f0935401101817e094c6ef9 to your computer and use it in GitHub Desktop.
bash script to create a tab-separated list of github issues on the command line
This file contains hidden or 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
#!/bin/sh | |
# https://stackoverflow.com/questions/48659631/github-issues-api-and-jq-filter-and-grep | |
# get github issues | |
GITHUB_PAT=5b01b116.... | |
#user=Leaflet | |
#repo=Leaflet | |
user=stedolan | |
repo=jq | |
url=https://$GITHUB_PAT:[email protected]/repos/$user/$repo/issues | |
echo curl -k -I $url?state=all\\\&per_page=10 | |
tot_page=`curl -k -I $url?state=all\&per_page=10 2>/dev/null | awk -F'[&=<>]' '{for(i=1;i<=NF;i++) if($i ~ /^page$/) {kk=$(i+1)}} END{print kk}'`; | |
echo "total issues: $tot_page" | |
for i in $( seq 1 $tot_page); do | |
curl -k $url?state=all\&per_page=10\&page=$i 2>/dev/null | \ | |
jq -L$HOME/.jq -r '.[] | (.created_at | sub("Z.*";"")) as $date | select($date) | [.number, .user.login, .state, .created_at] | @tsv' | |
#jq -L $HOME/.jq '.[] | (.created_at | sub("Z.*";"")) as $date | select($date | older(7) | not) | [.number, .user.login, .state, .created_at] | @tsv' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment