Created
November 22, 2016 16:50
-
-
Save nhashmi/5e491e093438ef66a9b0d1bba7f10c10 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
set -e | |
BASE_BRANCH="develop" | |
suggest_reviewers() { | |
echo '*Suggested Reviewers*\n--------------------' | |
collect_file_names | blame_files | |
} | |
collect_file_names() { | |
git diff --name-only HEAD $BASE_BRANCH | |
} | |
blame_files() { | |
xargs -L 1 git blame --line-porcelain | count_lines | |
} | |
count_lines() { | |
sed -n 's/^author //p' | authors_of_most_lines | |
} | |
authors_of_most_lines() { | |
sort | uniq -c | sort -rn | head -3 | |
} | |
suggest_reviewers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment