Created
February 4, 2024 02:45
-
-
Save dafurman/04c318fe8735049e0a6949977c002a42 to your computer and use it in GitHub Desktop.
Count lines changed in PRs
This file contains hidden or 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/zsh | |
# Put this the repo you want to examine | |
if [ $# -eq 0 ]; then | |
echo "Please provide PR numbers as arguments." | |
exit 1 | |
fi | |
prs=("$@") | |
totalLines=0 | |
for pr in "${prs[@]}"; do | |
lines=$(gh pr diff "$pr" | diffstat | awk '{ total += $4 + $6 } END { print total }') | |
echo "lines changed for $pr: $lines" | |
((totalLines += lines)) | |
done | |
echo "Total lines changed for all prs: $totalLines" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment