Skip to content

Instantly share code, notes, and snippets.

@psschwei
Last active July 25, 2025 20:32
Show Gist options
  • Select an option

  • Save psschwei/3c4f3fe100faf4eb8cd077eae436fc5c to your computer and use it in GitHub Desktop.

Select an option

Save psschwei/3c4f3fe100faf4eb8cd077eae436fc5c to your computer and use it in GitHub Desktop.
# To get enterprise activity:
# GH_HOST=github.enterprise.com ./weekly-activity.sh
which gdate > /dev/null && date_cmd="gdate" || date_cmd="date"
starting_date=$($date_cmd -dlast-monday +"%Y-%m-%d")
gh_search_flags="--updated >=$starting_date --json repository,title,url"
prs_cmd="gh search prs --author @me $gh_search_flags"
reviewed_cmd="gh search prs --reviewed-by @me $gh_search_flags"
issues_cmd="gh search issues --involves @me $gh_search_flags"
prs_len=$($prs_cmd | jq 'length')
reviews_len=$($reviewed_cmd -- -author:@me | jq 'length')
issues_len=$($issues_cmd | jq 'length')
echo "${GH_HOST:=github.com} activity since $starting_date"
echo
if [[ $prs_len > 0 ]]; then
echo "PRs ($prs_len)"
$prs_cmd --template '{{ range . }}{{ printf "* [%s] %s: %s\n" .repository.nameWithOwner .title .url }}{{ end }}'
fi
if [[ $reviews_len > 0 ]]; then
echo "Reviews ($reviews_len)"
$reviewed_cmd --template '{{ range . }}{{ printf "* [%s] %s: %s\n" .repository.nameWithOwner .title .url }}{{ end }}' -- -author:@me
fi
if [[ $issues_len > 0 ]]; then
echo "Issues ($issues_len)"
$issues_cmd --template '{{ range . }}{{ printf "* [%s] %s: %s\n" .repository.nameWithOwner .title .url }}{{ end }}'
fi
echo
echo "Totals: PRs($prs_len) Reviews($reviews_len) Issues($issues_len)"
@ajbozarth
Copy link

For reference for those that find this, you can run it with any of the following commands, which could be added as local alias':

  • curl -sSL https://ibm.biz/gh-activity | sh
  • bash <(curl -sL https://ibm.biz/gh-activity)
  • GH_HOST=github.ibm.com bash <(curl -sL https://ibm.biz/gh-activity)
  • curl -sSL https://ibm.biz/gh-activity | GH_HOST=github.ibm.com sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment