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

Chore: Add a script to parse community contributors in each release #2236

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions hack/github/community-contributors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash -u

TOKEN=$(cat $HOME/.git/token)

RELEASES=$(
curl -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $TOKEN" \
https://api.github.com/repos/aws/karpenter/releases
)
LATEST=$(echo $RELEASES | jq -r ".[0].tag_name")
PREVIOUS=$(echo $RELEASES | jq -r ".[1].tag_name")

COMMITS=$(curl -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $TOKEN" \
https://api.github.com/repos/aws/karpenter/compare/$PREVIOUS...$LATEST)

CONTRIBUTIONS=$(
echo $COMMITS | jq -r '
.commits
| sort_by(.commit.author.date)
| .[].commit
| {author: .author.name, message: (.message | split("\n")[0])}
' | jq -s
)
NUM_CONTRIBUTIONS=$(echo $CONTRIBUTIONS | jq length)

COMMUNITY_CONTRIBUTIONS=$(
echo $CONTRIBUTIONS | jq -r '
.[]
| select(
.author != "Ellis Tarn" and
.author != "Suket Sharma" and
.author != "Todd Neal" and
.author != "Nick Tran" and
.author != "Jason Deal" and
.author != "Ryan Maleki" and
.author != "Jonathan Innis" and
.author != "Brandon Wagner" and
.author != "Chris Negus" and
.author != "Jim DeWaard" and
.author != "dependabot[bot]"
)
' | jq -s
)

NUM_COMMUNITY_CONTRIBUTIONS=$(echo $COMMUNITY_CONTRIBUTIONS | jq length)

echo "Comparing $PREVIOUS and $LATEST"
echo "Community members contributed $NUM_COMMUNITY_CONTRIBUTIONS/$NUM_CONTRIBUTIONS ($(awk "BEGIN {print (100*$NUM_COMMUNITY_CONTRIBUTIONS/$NUM_CONTRIBUTIONS)}")%) commits"
echo $COMMUNITY_CONTRIBUTIONS | jq