Skip to content

Commit 148ed86

Browse files
authored
Merge pull request #3765 from hey-api/pullfrog/3764-filter-bot-contributors
2 parents 1557dba + de341a6 commit 148ed86

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

docs/.contributorsignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/partials/contributors-list.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,4 @@
115115
- [jcx0](https://github.com/jcx0)
116116
- [maxdew-envelio](https://github.com/maxdew-envelio)
117117
- [nnzhadow](https://github.com/nnzhadow)
118-
- [pullfrog[bot]](https://github.com/pullfrog[bot])
119-
- [pullfrog[bot]](https://github.com/pullfrog[bot])
120118
- [renoschubert](https://github.com/renoschubert)

scripts/update-contributors.sh

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ if [[ -n "${GITHUB_TOKEN:-}" ]]; then
1616
AUTH_HEADER=(-H "Authorization: token $GITHUB_TOKEN")
1717
fi
1818

19-
EXCLUDED_FILE="./docs/.contributorsignore"
2019
SINCE_FILE="./docs/.contributorssince"
2120

2221
# disabled for now, we'd need to append to the list instead of write
@@ -69,23 +68,30 @@ while :; do
6968
jq -r '.[].author | select(.login != null) | .login' "$TMP_JSON" | sort -u > "$TMP_LOGINS"
7069

7170
while read -r login; do
72-
if ! grep -Fxq "$login" "$EXCLUDED_FILE"; then
73-
if ! printf '%s\n' "${USERS[@]}" | grep -qx "$login"; then
74-
USERS+=("$login")
75-
76-
CACHE_FILE="$CACHE_DIR/$login.json"
77-
if [ -f "$CACHE_FILE" ]; then
78-
USER_JSON=$(<"$CACHE_FILE")
79-
else
80-
echo "Fetching user $login"
81-
USER_JSON=$(curl -s "${AUTH_HEADER[@]}" "https://api.github.com/users/$login")
82-
echo "$USER_JSON" > "$CACHE_FILE"
83-
fi
84-
85-
SANITIZED_JSON=$(echo "$USER_JSON" | tr -d '\000-\037')
86-
NAME=$(jq -r '.name // empty' <<< "$SANITIZED_JSON")
87-
echo "$login|$NAME" >> "$TMP_USERS"
71+
if [[ "$login" == *"[bot]" ]]; then
72+
continue
73+
fi
74+
75+
if ! printf '%s\n' "${USERS[@]}" | grep -qx "$login"; then
76+
CACHE_FILE="$CACHE_DIR/$login.json"
77+
if [ -f "$CACHE_FILE" ]; then
78+
USER_JSON=$(<"$CACHE_FILE")
79+
else
80+
echo "Fetching user $login"
81+
USER_JSON=$(curl -s "${AUTH_HEADER[@]}" "https://api.github.com/users/$login")
82+
echo "$USER_JSON" > "$CACHE_FILE"
83+
fi
84+
85+
SANITIZED_JSON=$(echo "$USER_JSON" | tr -d '\000-\037')
86+
87+
USER_TYPE=$(jq -r '.type // "User"' <<< "$SANITIZED_JSON")
88+
if [[ "$USER_TYPE" == "Bot" ]]; then
89+
continue
8890
fi
91+
92+
USERS+=("$login")
93+
NAME=$(jq -r '.name // empty' <<< "$SANITIZED_JSON")
94+
echo "$login|$NAME" >> "$TMP_USERS"
8995
fi
9096
done < "$TMP_LOGINS"
9197

0 commit comments

Comments
 (0)