Last active
July 14, 2020 15:17
-
-
Save amatmv/310dbd1f3146d7877a2c831455376889 to your computer and use it in GitHub Desktop.
Generate a big diff from list of Pull Requests
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/bash | |
# | |
# Usage: | |
# | |
# Indicate the name of the output file with the flag: -f | |
# Indicate the list of Pull Requests with the flat: -p. The format is a quoted string sepparated by spaces. | |
# | |
while getopts p:f: option | |
do | |
case "${option}" | |
in | |
p) PRS=${OPTARG};; | |
f) FILE=${OPTARG};; | |
esac | |
done | |
for pr in $PRS; | |
do | |
echo "Getting diff from PR $pr" | |
curl -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.diff" https://api.github.com/repos/gisce/erp/pulls/$pr >> $FILE; | |
cat $FILE | grep "Binary files" && echo "Oju! Hi ha un fitxer binari!" | |
done | |
echo "Finish!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment