Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONTRIB: Automate AUTHORS file update #10308

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Akshay Venkatesh <[email protected]>
Aleksey Senin <[email protected]>
Alexey Rivkin <[email protected]>
Alex Margolin <[email protected]>
Alex Mikheev <[email protected]>
Alexey Rivkin <[email protected]>
Alina Sklarevich <[email protected]>
Anatoly Vildemanov <[email protected]>
Andrey Maslennikov <[email protected]>
Expand Down
25 changes: 25 additions & 0 deletions buildlib/pr/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
45 changes: 45 additions & 0 deletions contrib/authors_update.sh
Original file line number Diff line number Diff line change
@@ -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}"

michal-shalev marked this conversation as resolved.
Show resolved Hide resolved
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
yosefe marked this conversation as resolved.
Show resolved Hide resolved
echo "$line" >>"$tmp"
echo "++ $line"
else
echo " $line"
fi
done

LC_COLLATE=C sort -o "$tmp"{,}
grep -v @ AUTHORS >>"$tmp"
mv "$tmp" AUTHORS
Loading