Skip to content

Instantly share code, notes, and snippets.

@dafurman
Created February 4, 2024 02:42
Show Gist options
  • Save dafurman/b6ef7bb4c5d17e7e5ea6abe82370e1ee to your computer and use it in GitHub Desktop.
Save dafurman/b6ef7bb4c5d17e7e5ea6abe82370e1ee to your computer and use it in GitHub Desktop.
Count files changed in PRs
#!/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=("$@")
totalFiles=0
for pr in "${prs[@]}"; do
files=$(gh pr diff "$pr" | diffstat -l | wc -l)
echo "Files changed for $pr: $files"
((totalFiles += files))
done
echo "Total files changed for all prs: $totalFiles"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment