Created
November 23, 2017 16:08
-
-
Save karelhala/583505a7846f45abb0974b5a23a969eb 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
#!/bin/sh | |
year=$(date --date="7 days ago" +"%Y") | |
month=$(date --date="7 days ago" +"%m") | |
day=$(date --date="7 days ago" +"%d") | |
file=/tmp/$2.html | |
wget -q -O $file "https://github.com/$1/$2/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3A$3%20updated%3A%3E%3D$year-$month-$day%20sort%3Acreated-asc" >/dev/null | |
urls=$(cat $file | sed -n "s/<a href=\"\(\/$1\/$2\/pull\/[0-9]*\)\" class=\"[^m][^>]*[^>]*>/\1/p") | |
descriptions=$(cat $file | sed -n "/<a href=\"\(\/$1\/$2\/pull\/[0-9]*\)\" class=\"[^m][^>]*[^>]*>/{n;p}") | |
statuses=$(cat $file | sed -n "s/<span class=\"tooltipped tooltipped-n\" aria-label=\"\([^ ]*\) .*/\1/p") | |
descriptions=$(echo "${descriptions}" | sed -e 's/^[ \t]*//g') | |
statuses=$(echo "${statuses}" | sed -e 's/^[ \t]*//g') | |
set -f # avoid globbing (expansion of *). | |
urlArray=(${urls// / }) | |
IFS=$'\n' descriptionArray=($descriptions) | |
IFS=$'\n' statuseArray=($statuses) | |
for i in "${!urlArray[@]}" | |
do | |
description=$(echo "${descriptionArray[i]}" | perl -MHTML::Entities -pe 'decode_entities($_);') | |
echo "https://github.com${urlArray[i]} [${statuseArray[i]}] - $description" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That is really useful Karel!
Do you think it could be useful to have this little piece of help?