diff --git a/AUTHORS b/AUTHORS index d50feb20330..a12d372e3ad 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,8 +1,8 @@ Akshay Venkatesh Aleksey Senin -Alexey Rivkin Alex Margolin Alex Mikheev +Alexey Rivkin Alina Sklarevich Anatoly Vildemanov Andrey Maslennikov diff --git a/buildlib/pr/codestyle.yml b/buildlib/pr/codestyle.yml index 561cf0c0b02..2b643a2bd05 100644 --- a/buildlib/pr/codestyle.yml +++ b/buildlib/pr/codestyle.yml @@ -63,6 +63,31 @@ jobs: fi condition: eq(variables['Build.Reason'], 'PullRequest') + - job: author + displayName: AUTHORS file update check + pool: + name: MLNX + demands: + - ucx_docker -equals yes + container: fedora + steps: + - checkout: self + clean: true + fetchDepth: 100 + retryCountOnTaskFailure: 5 + + - bash: | + set -eEx + + BASE_SOURCEVERSION=$(git rev-parse HEAD^) + range="$BASE_SOURCEVERSION..$(Build.SourceVersion)" + + echo "Looking for missing AUTHORS on commit range ${range}" + ./contrib/authors_update.sh "$range" + git diff --exit-code + displayName: AUTHORS file check + + - job: codespell displayName: codespell check pool: diff --git a/contrib/authors_update.sh b/contrib/authors_update.sh new file mode 100755 index 00000000000..a9e60a625c9 --- /dev/null +++ b/contrib/authors_update.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# See file LICENSE for terms. +# + +set -eEu -o pipefail + +range="${1?Provide commit range like, for example: orig/v1.17..orig/v1.18}" + +if [ ! -w AUTHORS ] +then + echo "AUTHORS file is not writable" + exit 1 +fi + +# Failure message triggered if range is not valid +lines=$(git log --no-merges --pretty=format:"%an%x09%ae" "$range" | sort -u) +if [ -z "$lines" ] +then + echo "Error: provided range \"$range\" is empty" + exit 1 +fi + +tmp=$(mktemp --tmpdir=./) +grep @ AUTHORS >"$tmp" + +echo "Names:" + +echo -e "$lines" | \ +while IFS=$'\t' read -r name email; do + line="$name <$email>" + + # Check for known email, or identical name + if ! grep -iqw "$email" "$tmp" && ! grep -iq "$name" "$tmp"; then + echo "$line" >>"$tmp" + echo "++ $line" + else + echo " $line" + fi +done + +LC_COLLATE=C sort -o "$tmp"{,} +grep -v @ AUTHORS >>"$tmp" +mv "$tmp" AUTHORS