From 7c8b3e99679ef5853f266ac31f26bf49fb06d852 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 13 Nov 2022 21:44:10 +0100 Subject: [PATCH] Add a script to add new contributors --- extra/release/update-contributors.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 extra/release/update-contributors.sh diff --git a/extra/release/update-contributors.sh b/extra/release/update-contributors.sh new file mode 100755 index 00000000..fe896b64 --- /dev/null +++ b/extra/release/update-contributors.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +function path_in_repo() +{ + echo "$(git rev-parse --show-toplevel)/$*" +} +function main() +{ + local new_contributors + new_contributors="$(mktemp libevent.XXXXXX)" + trap "rm $new_contributors $new_contributors.filtered" EXIT + + git log "$(git describe --abbrev=0)..HEAD" --pretty='format:%cN%n%aN' > "$new_contributors" + awk '/^ \* / { split($0, cols, " \\* "); print(cols[2]); }' "$(path_in_repo CONTRIBUTORS.md)" | { + grep -F -x -v -f "$new_contributors" + } | { + local grep_patterns=( + GitHub + ) + grep -F -x -v "${grep_patterns[@]}" + } > "$new_contributors.filtered" + awk '{printf(" * %s\n", $0)}' "$new_contributors.filtered" >> "$(path_in_repo CONTRIBUTORS.md)" +} +main "$@" -- 2.40.0