Skip to content

Commit 4ac1b42

Browse files
committed
Update authors
Copy update_authors.sh from libASPL and re-run.
1 parent 5a439ea commit 4ac1b42

File tree

2 files changed

+77
-52
lines changed

2 files changed

+77
-52
lines changed

AUTHORS.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
Signal Estimator authors, ordered by first contribution:
44

5-
* Victor Gaydov (victor@enise.org)
6-
* BitsonFire (neerajkarthik30@gmail.com)
7-
* Vien Huynh (https://github.com/Vhuynh25)
8-
* robotboyfriend (https://github.com/robotboyfriend)
9-
* Théo Lebrun (theo.lebrun@bootlin.com)
10-
* Marco Langer (langer.m86@gmail.com)
5+
* Victor Gaydov `gavv` (victor@enise.org)
6+
* BitsonFire `BitsonFire` (neerajkarthik30@gmail.com)
7+
* Vien Huynh `Vhuynh25` (https://github.com/Vhuynh25)
8+
* robotboyfriend `robotboyfriend` (https://github.com/robotboyfriend)
9+
* Théo Lebrun `Falydoor` (theo.lebrun@bootlin.com)
10+
* Marco Langer `marco-langer` (langer.m86@gmail.com)
1111
* Boring Technologies (sam@boring.tech)
12-
* Mikhail Baranov (baranov.mv@gmail.com)
13-
* Chinry (nlembo99@gmail.com)
14-
* Aadithyaa Eeswaran (eaadithyaa@gmail.com)
15-
* Jānis Ancāns (janis.ancans@runbox.eu)
16-
* Chloe Stejskal (stejskcl@miamioh.edu)
12+
* Mikhail Baranov `baranovmv` (baranov.mv@gmail.com)
13+
* Chinry `Chinry` (nlembo99@gmail.com)
14+
* Aadithyaa Eeswaran `aadit-n3rdy` (eaadithyaa@gmail.com)
15+
* Jānis Ancāns `RandomJanis` (janis.ancans@runbox.eu)
16+
* Chloe Stejskal `stejskcl` (stejskcl@miamioh.edu)
17+
* Oleksandr Mykhailyshyn `saneck2150` (saneck2150@gmail.com)

script/update_authors.sh

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
#!env bash
1+
#! /bin/bash
2+
#
3+
# This script builds a nice list of contributors (full name, github login, email).
4+
# If you want to change your appearance in generated file, feel free to send a PR!
5+
#
6+
7+
set -euo pipefail
28

39
function find_login() {
4-
local github_login="$(curl -s "https://api.github.com/search/users?q=$1" \
10+
local github_login="$(curl -s --get "https://api.github.com/search/users" \
11+
--data-urlencode "q=$1" \
512
| jq -r '.items[0].login' 2>/dev/null)"
613

714
if [[ "${github_login}" != "" ]] && [[ "${github_login}" != "null" ]]
@@ -10,6 +17,8 @@ function find_login() {
1017
fi
1118
}
1219

20+
# If the user has full name in their public github profile, use it.
21+
# Otherwise we'll fallback to whatever we have in git.
1322
function find_name() {
1423
local github_name="$(curl -s "https://api.github.com/users/$1" \
1524
| jq -r .name 2>/dev/null \
@@ -21,7 +30,20 @@ function find_name() {
2130
fi
2231
}
2332

33+
# Github preserves git committer email if PR was merged using rebase-merge, but
34+
# spoils it if it was merged using squash-merge, which is annoying! If the
35+
# user originally provided a real email in their public git commits, we'll use
36+
# it, otherwise we'll fall back to whatever we have in git after merging PR.
2437
function find_email() {
38+
local reflog_email="$(git reflog --pretty=format:"%an <%ae>" | sort -u | \
39+
grep -vF users.noreply.github.com | grep -F "$1" | sed -re 's,.*<(.*)>,\1,')"
40+
41+
if [[ "${reflog_email}" != "" ]]
42+
then
43+
echo "${reflog_email}"
44+
return
45+
fi
46+
2547
local github_email="$(curl -s "https://api.github.com/users/$1/events/public" \
2648
| jq -r \
2749
'((.[].payload.commits | select(. != null))[].author | select(.name == "'$1'")).email' \
@@ -34,16 +56,9 @@ function find_email() {
3456
then
3557
echo "${github_email}"
3658
fi
37-
38-
local reflog_email="$(git reflog --pretty=format:"%an <%ae>" | sort -u | \
39-
grep -vF users.noreply.github.com | grep -F "$1" | sed -re 's,.*<(.*)>,\1,')"
40-
41-
if [[ "${reflog_email}" != "" ]]
42-
then
43-
echo "${reflog_email}"
44-
fi
4559
}
4660

61+
# Add contributor if not already added.
4762
function add_if_new() {
4863
local file="$1"
4964

@@ -68,43 +83,59 @@ function add_if_new() {
6883
fi
6984
fi
7085

71-
local print_name="$(find_name "${github_login}")"
72-
if [ -z "${print_name}" ]
86+
if grep -qiF "/${github_login}/" "${file}"
87+
then
88+
return
89+
fi
90+
91+
local full_name="$(find_name "${github_login}")"
92+
if [ -z "${full_name}" ]
7393
then
74-
print_name="${commit_name}"
94+
full_name="${commit_name}"
7595
fi
76-
print_name="$(echo "${print_name}" | sed -re 's/\S+/\u&/g')"
96+
full_name="$(echo "${full_name}" | sed -re 's/\S+/\u&/g')"
7797

78-
local print_addr=""
98+
local address=""
7999
if echo "${commit_email}" | grep -q users.noreply.github.com
80100
then
81101
if [[ ! -z "${github_login}" ]]
82102
then
83-
print_addr="$(find_email "${github_login}")"
103+
address="$(find_email "${github_login}")"
84104
fi
85105
else
86-
print_addr="${commit_email}"
106+
address="${commit_email}"
87107
fi
88-
if [[ -z "${print_addr}" && ! -z "${github_login}" ]]
108+
if [[ -z "${address}" && ! -z "${github_login}" ]]
89109
then
90-
print_addr="https://github.com/${github_login}"
110+
address="https://github.com/${github_login}"
91111
fi
92112

93-
if [ -z "${print_addr}" ]
113+
local result="${full_name}"
114+
if [ ! -z "${github_login}" ]
94115
then
95-
echo "Adding ${print_name}" 1>&2
96-
echo "* ${print_name}"
97-
else
98-
echo "Adding ${print_name} (${print_addr})" 1>&2
99-
echo "* ${print_name} (${print_addr})"
116+
result="${result} \`${github_login}\`"
117+
fi
118+
if [ ! -z "${address}" ]
119+
then
120+
result="${result} (${address})"
100121
fi
122+
123+
echo "adding ${result}" 1>&2
124+
echo "* ${result}"
101125
}
102126

127+
# Find all new contributors and append to the file.
103128
function add_contributors() {
104129
out_file="$1"
105-
repo_dir="$2"
130+
repo_dir="$(pwd)"
106131

107-
git log --encoding=utf-8 --full-history --reverse "--format=format:%at,%an,%ae" \
132+
if [ ! -d "${repo_dir}" ]
133+
then
134+
return
135+
fi
136+
137+
GIT_DIR="${repo_dir}"/.git \
138+
git log --encoding=utf-8 --full-history --reverse "--format=format:%at,%an,%ae" \
108139
| sort -u -t, -k3,3 \
109140
| sort -t, -k1n \
110141
| while read line
@@ -116,20 +147,13 @@ function add_contributors() {
116147
done
117148
}
118149

119-
function update_authors() {
120-
file="AUTHORS.md"
121-
temp="$(mktemp)"
122-
123-
cat "${file}" > "${temp}"
124-
125-
add_contributors "${temp}" "$(pwd)"
126-
127-
cat "$temp" > "${file}"
128-
rm "${temp}"
129-
}
150+
result_file="AUTHORS.md"
151+
temp_file="$(mktemp)"
130152

131-
cd "$(dirname "$0")/.."
153+
cat "${result_file}" > "${temp_file}"
154+
add_contributors "${temp_file}"
132155

133-
update_authors "${sphinx}"
156+
cat "${temp_file}" > "${result_file}"
157+
rm "${temp_file}"
134158

135-
echo "Updated AUTHORS.md"
159+
echo "updated ${result_file}"

0 commit comments

Comments
 (0)