DBZ-2592 Clean up, Handle octocat commits

This commit is contained in:
Anisha Mohanty 2021-03-12 20:37:04 +05:30 committed by Gunnar Morling
parent 8bac620efd
commit b7816e97a4
3 changed files with 22 additions and 12 deletions

View File

@ -17,4 +17,4 @@ jobs:
steps:
- name: Run script
run: |
chomd +x ./github-support/list-contributors.sh ${{ github.event.inputs.tag1 }} ${{ github.event.inputs.tag2 }}
./github-support/list-contributors.sh ${{ github.event.inputs.tag1 }} ${{ github.event.inputs.tag2 }}

View File

@ -164,7 +164,6 @@ Marc Zbyszynski
Mario Mueller
Mariusz Strzelecki
Martin Sillence
martper2
Matt Beary
Matteo Capitanio
Mathieu Rozieres

View File

@ -1,12 +1,14 @@
#!/bin/bash
DIR="/tmp/debezium-contributors"
set -euo
DIR="$HOME/debezium-contributors"
ALIASES="jenkins-jobs/scripts/config/Aliases.txt"
FILTERS="jenkins-jobs/scripts/config/FilteredNames.txt"
mkdir -p $DIR
CONTRIBUTORS_NAMES="$DIR/$TAG2-DEBEZIUM_CONTRIBUTORS_LIST.txt"
CONTRIBUTORS_NAMES="$DIR/$2-DEBEZIUM_CONTRIBUTORS_LIST.txt"
CONTRIBUTORS_LIST_JSON="$DIR/CONTRIBUTORS.json"
CONTRIBUTORS_LIST_TXT="$DIR/DEBEZIUM_CONTRIBUTORS.txt"
CONTRIBUTORS_ALIASES="$DIR/Aliases.txt"
@ -18,23 +20,32 @@ declare -a DEBEZIUM_REPOS=("debezium" "debezium-connector-db2" "debezium-connect
for REPO in "${DEBEZIUM_REPOS[@]}";
do
curl -X "GET" "https://api.github.com/repos/debezium/$REPO/compare/$TAG1...$TAG2" -H "Authorization: token $AUTH_TOKEN" | jq '.commits[] | {name: .commit.author.name, github_url: .author.html_url}' &>> "$CONTRIBUTORS_LIST_JSON"
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}' &>> "$CONTRIBUTORS_LIST_JSON"
done
jq -r '.github_url + " " + .name' $CONTRIBUTORS_LIST_JSON > $CONTRIBUTORS_NAMES
while IFS=" " read -r URL NAME;
do
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
elif grep -qi "^$NAME" $CONTRIBUTORS_FILTERS; then
sed -n "/$NAME/d" $CONTRIBUTORS_NAMES &>> $CONTRIBUTORS_LIST_TXT
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
else
sed -n -e "s/ $NAME/\[$NAME\]\,/p" $CONTRIBUTORS_NAMES &>> $CONTRIBUTORS_LIST_TXT
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
elif grep -qi "^$NAME" $CONTRIBUTORS_FILTERS; then
sed -n "/$NAME/d" $CONTRIBUTORS_NAMES >> $CONTRIBUTORS_LIST_TXT
else
sed -n -e "s/ $NAME/\[$NAME\]/p" $CONTRIBUTORS_NAMES >> $CONTRIBUTORS_LIST_TXT
fi
fi
done < $CONTRIBUTORS_NAMES
sort $CONTRIBUTORS_LIST_TXT | uniq > $CONTRIBUTORS_NAMES && mv $CONTRIBUTORS_NAMES /tmp/
sort $CONTRIBUTORS_LIST_TXT | uniq > $CONTRIBUTORS_NAMES
sed -e '$!s/$/,/' $CONTRIBUTORS_NAMES
rm -rf $DIR