diff options
Diffstat (limited to 'contrib/cirrus/success.sh')
-rwxr-xr-x | contrib/cirrus/success.sh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/cirrus/success.sh b/contrib/cirrus/success.sh index 30d375d95..3b171757f 100755 --- a/contrib/cirrus/success.sh +++ b/contrib/cirrus/success.sh @@ -4,7 +4,7 @@ set -e source $(dirname $0)/lib.sh -req_env_var CIRRUS_BRANCH CIRRUS_BUILD_ID CIRRUS_REPO_FULL_NAME CIRRUS_BASE_SHA CIRRUS_CHANGE_IN_REPO +req_env_var CIRRUS_BRANCH CIRRUS_REPO_FULL_NAME CIRRUS_BASE_SHA CIRRUS_CHANGE_IN_REPO CIRRUS_CHANGE_MESSAGE cd $CIRRUS_WORKING_DIR @@ -18,18 +18,21 @@ then then SHARANGE="${CIRRUS_BASE_SHA}..${CIRRUS_CHANGE_IN_REPO}" EXCLUDE_RE='merge-robot' + EMAILCSET='[:alnum:]-+_@.' AUTHOR_NICKS=$(egrep -v '(^[[:space:]]*$)|(^[[:space:]]*#)' "$AUTHOR_NICKS_FILEPATH" | sort -u) # Depending on branch-state, it's possible SHARANGE could be _WAY_ too big MAX_NICKS=10 # newline separated GITLOG="git log --format='%ae'" - COMMIT_AUTHORS=$($GITLOGt $SHARANGE || $GITLOG -1 HEAD | \ - sort -u | \ + COMMIT_AUTHORS=$($GITLOG $SHARANGE || $GITLOG -1 HEAD | \ + tr --delete --complement "$EMAILCSET[:space:]" | \ egrep -v "$EXCLUDE_RE" | \ + sort -u | \ tail -$MAX_NICKS) for c_email in $COMMIT_AUTHORS do + c_email=$(echo "$c_email" | tr --delete --complement "$EMAILCSET") echo -e "\tExamining $c_email" NICK=$(echo "$AUTHOR_NICKS" | grep -m 1 "$c_email" | \ awk --field-separator ',' '{print $2}' | tr -d '[[:blank:]]') @@ -40,8 +43,13 @@ then echo -e "\t\tNot found in $(basename $AUTHOR_NICKS_FILEPATH), using e-mail username." NICK=$(echo "$c_email" | cut -d '@' -f 1) fi - echo -e "\tUsing nick $NICK" - NICKS="${NICKS:+$NICKS, }$NICK" + if ! echo "$NICKS" | grep -q "$NICK" + then + echo -e "\tUsing nick $NICK" + NICKS="${NICKS:+$NICKS, }$NICK" + else + echo -e "\tNot re-adding duplicate nick $NICK" + fi done fi |