anki/.buildkite/linux/check_contributors

25 lines
771 B
Bash
Executable File

#!/bin/bash
set -eu -o pipefail ${SHELLFLAGS}
antispam=", at the domain "
headAuthor=$(git log -1 --pretty=format:'%ae')
authorAt=$(echo "$headAuthor" | sed "s/@/$antispam/")
if git log --pretty=format:'%ae' CONTRIBUTORS | grep -i "$headAuthor" > /dev/null; then
echo "Author found in CONTRIBUTORS"
else
echo "All contributors:"
git log --pretty=format:' - %ae' CONTRIBUTORS |sort |uniq |sort -f | sed "s/@/$antispam/"
echo "Author $authorAt NOT found in list"
echo
cat <<EOF
Please make sure you modify the CONTRIBUTORS file using the email address you
are committing from. If you have GitHub configured to hide your email address,
you may need to make a change to the CONTRIBUTORS file using the GitHub UI,
then try again.
EOF
exit 1
fi