Skip to content

Instantly share code, notes, and snippets.

@amatmv
Last active July 14, 2020 15:17
Show Gist options
  • Save amatmv/310dbd1f3146d7877a2c831455376889 to your computer and use it in GitHub Desktop.
Save amatmv/310dbd1f3146d7877a2c831455376889 to your computer and use it in GitHub Desktop.
Generate a big diff from list of Pull Requests
#!/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