-
Notifications
You must be signed in to change notification settings - Fork 951
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Add a script to parse community contributors in each release
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |