Last active
April 15, 2025 07:51
-
-
Save Nymphium/0750a4cef68967b8758716b4bb6608dd to your computer and use it in GitHub Desktop.
./集計くん.sh "2024-01-01" "2024-12-31" # displays the PRs each which you created between $1 and $2, and merged under the current dir, recursively
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
#!/usr/bin/env bash | |
set -eu | |
from_date=${1:-"2024-10-01"} | |
to_date=${2:-"2025-03-31"} | |
total=0 | |
f() { | |
if [[ -d .git ]]; then | |
repo="$(gh repo view --json owner,name --jq '.owner.login + "/"+ .name')" | |
ls="$(gh pr list --author="@me" --state="merged" --search="created:${from_date}..${to_date}" --json number,author,title,createdAt --jq '.[] | "#"+(.number|tostring ) + " @" + .author.name + " " + .createdAt + ": " + .title')" | |
num="$(wc -l <<< "$ls")" | |
if [[ -z "$ls" ]]; then | |
num=0 | |
fi | |
total=$((total + num)) | |
echo "$repo: $num" | |
echo "$ls" | |
echo "-----" | |
return | |
else | |
for d in ./*; do | |
if [[ -d "$d" ]]; then | |
pushd "$d" > /dev/null 2>&1 | |
f | |
popd > /dev/null 2>&1 | |
fi | |
done | |
fi | |
} | |
f | |
echo "Total: $total" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment