2021-03-02 13:53:08 +01:00
#!/bin/bash
2021-03-12 16:07:04 +01:00
set -euo
2021-03-17 19:45:00 +01:00
if [ $# -eq 0 ] ; then
echo "No release parameters provided"
exit 1
fi
2021-03-12 16:07:04 +01:00
DIR = " $HOME /debezium-contributors "
2021-03-02 13:53:08 +01:00
ALIASES = "jenkins-jobs/scripts/config/Aliases.txt"
FILTERS = "jenkins-jobs/scripts/config/FilteredNames.txt"
mkdir -p $DIR
2021-03-12 16:07:04 +01:00
CONTRIBUTORS_NAMES = " $DIR / $2 -DEBEZIUM_CONTRIBUTORS_LIST.txt "
2021-03-02 13:53:08 +01:00
CONTRIBUTORS_LIST_TXT = " $DIR /DEBEZIUM_CONTRIBUTORS.txt "
CONTRIBUTORS_ALIASES = " $DIR /Aliases.txt "
CONTRIBUTORS_FILTERS = " $DIR /FilteredNames.txt "
cp $ALIASES $FILTERS $DIR && cd $DIR
2024-07-30 15:02:30 +02:00
declare -a DEBEZIUM_REPOS = ( "debezium" "debezium-server" "debezium-operator" "debezium-connector-db2" "debezium-connector-cassandra" "debezium-connector-vitess" "debezium-connector-spanner" "debezium-ui" "container-images" )
2021-03-02 13:53:08 +01:00
for REPO in " ${ DEBEZIUM_REPOS [@] } " ;
do
2021-10-11 09:22:20 +02:00
page_count = $( curl --silent -I " https://api.github.com/repos/debezium/ $REPO /compare/ $1 ... $2 ?page=1&per_page=100 " | tr "," $'\n' | grep 'rel="last"' | cut -f1 -d';' | tr "?&" $'\n' | grep -e "^page" | cut -f2 -d= )
if [ [ -z $page_count ] ] ; then
curl --silent -X "GET" " https://api.github.com/repos/debezium/ $REPO /compare/ $1 ... $2 " | jq '.commits[] | {name: .commit.author.name, github_url: .author.html_url}' | jq -r '.github_url + " " + .name' >> " $CONTRIBUTORS_NAMES "
else
for ( ( i = 1; i < " $(( page_count + 1 )) " ; i++ ) ) ; do
curl --silent -X "GET" " https://api.github.com/repos/debezium/ $REPO /compare/ $1 ... $2 ?page= $i &per_page=100 " | jq '.commits[] | {name: .commit.author.name, github_url: .author.html_url}' | jq -r '.github_url + " " + .name' >> " $CONTRIBUTORS_NAMES "
done
fi
2021-03-02 13:53:08 +01:00
done
while IFS = " " read -r URL NAME;
do
2021-05-20 18:03:56 +02:00
NAME = ` echo " $NAME " | tr "/" " " `
2021-03-12 16:07:04 +01:00
if [ [ -z " $NAME " ] ] ; then
if grep -qi " ^ $URL " $CONTRIBUTORS_ALIASES ; then
REAL_NAME = ` grep -i " ^ $URL " $CONTRIBUTORS_ALIASES | head -1 | awk '{split($0,a,","); print a[2]}' `
sed -n -e " s/ $URL / $REAL_NAME /p " $CONTRIBUTORS_NAMES >> $CONTRIBUTORS_LIST_TXT
fi
2021-03-02 13:53:08 +01:00
else
2021-03-12 16:07:04 +01:00
if grep -qi " ^ $NAME " $CONTRIBUTORS_ALIASES ; then
REAL_NAME = ` grep -i " ^ $NAME " $CONTRIBUTORS_ALIASES | head -1 | awk '{split($0,a,","); print a[2]}' `
sed -n -e " s/ $NAME /\[ $REAL_NAME \]/p " $CONTRIBUTORS_NAMES >> $CONTRIBUTORS_LIST_TXT
2021-03-17 19:45:00 +01:00
elif grep -qi " $NAME " $CONTRIBUTORS_FILTERS ; then
2021-03-12 16:07:04 +01:00
sed -n " / $NAME /d " $CONTRIBUTORS_NAMES >> $CONTRIBUTORS_LIST_TXT
else
sed -n -e " s/ $NAME /\[ $NAME \]/p " $CONTRIBUTORS_NAMES >> $CONTRIBUTORS_LIST_TXT
fi
2021-03-02 13:53:08 +01:00
fi
done < $CONTRIBUTORS_NAMES
2021-03-17 19:45:00 +01:00
sort -t[ -k2 $CONTRIBUTORS_LIST_TXT | uniq > $CONTRIBUTORS_NAMES
2021-03-12 16:07:04 +01:00
sed -e '$!s/$/,/' $CONTRIBUTORS_NAMES
2021-03-02 13:53:08 +01:00
2021-03-17 19:45:00 +01:00
FIX_VERSION = ` echo $2 | cut -d "v" -f 2`
echo " List of issues: https://issues.redhat.com/issues/?jql=project%20%3D%20DBZ%20AND%20fixVersion%20%3D%20 $FIX_VERSION %20ORDER%20BY%20issuetype%20DESC "
2021-03-02 13:53:08 +01:00
rm -rf $DIR