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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

tvegas1
Copy link
Contributor

@tvegas1 tvegas1 commented Nov 19, 2024

What?

Automate AUTHORS updates according to documentation.

Why?

Seems better to try to have common approach.

How?

$ ./contrib/authors_update.sh upstream/v1.17.x..upstream/v1.18.x
..
   Artemy Kovalyov <artemyko@nvidia.com>
++ Arun Chandran <Arun.Chandran@amd.com>
   Edgar Gabriel <Edgar.Gabriel@amd.com>
   Evgeny Leksikov <evgenylek@mellanox.com>
..

Copy link
Contributor

@yosefe yosefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add this script to CI, so that if new author is adding a commit and it is not in AUTHORS file, the CI fails?

@tvegas1
Copy link
Contributor Author

tvegas1 commented Nov 20, 2024

adding to CI imposes PR creators to have their commits under exact email, or name, could this become a problem at some point?

michal-shalev
michal-shalev previously approved these changes Nov 21, 2024
Copy link
Contributor

@michal-shalev michal-shalev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Comment on lines 17 to 25
if [ "$(git log --no-merges --oneline "$range" | wc -l)" -eq 0 ]
then
echo "Error: empty range \"$range\""
exit 1
fi

# Failure triggered if range is not valid
git --no-pager log --no-merges --oneline --pretty=format:"%h %an <%ae> %s" \
"$range"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do the range validity check in one git command? and if only for validity, why need pretty format?

Copy link
Contributor Author

@tvegas1 tvegas1 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok make sense, retested empty/bad range and patched, that removed the commit list, I think that's also ok since it can be very long.

git log --no-merges --pretty=format:"%an%x09%ae" "$range" | sort | uniq | \
while IFS=$'\t' read -r name email; do
line="$name <$email>"
if ! grep -iqw "$email" "$tmp" && ! grep -iq "$name" "$tmp"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you pls add comment what this does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added


if [ ! -w AUTHORS ]
then
echo "AUTHORS file not accessible"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not writable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, but -w also covers the case where file does not exist


set -eEu -o pipefail

range="${1?Provide commit range like orig/v1.17..orig/v1.18}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like -> , for example:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

lines=$(git log --no-merges --pretty=format:"%an%x09%ae" "$range" | sort | uniq)
if [ -z "$lines" ]
then
echo "Error: empty range \"$range\""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provided range is empty

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants