Skip to content

Instantly share code, notes, and snippets.

@displague
Last active August 2, 2023 20:49
Show Gist options
  • Save displague/4d6b93d2efe14efd5a1ec97ae3fa020d to your computer and use it in GitHub Desktop.
Save displague/4d6b93d2efe14efd5a1ec97ae3fa020d to your computer and use it in GitHub Desktop.
QBR: GitHub releases over the past quarter (customize with your orgs and repos)
#!/usr/bin/env bash
quarters=${1:-0} # Modified this line to set quarters to 0
year=$(date +%Y)
month=$(date +%m)
quarter=$(((${month##0} - 1) / 3 + 1)) # trim leading zeros or invalid octals in August and September
quarter_patterns=(
[1]="0[1-3]" [2]="0[4-6]"
[3]="0[7-9]" [4]="1[0-2]"
)
all_patterns=""
for ((i=0; i<=quarters; i++)); do
pattern="$year-${quarter_patterns[$quarter]}"
all_patterns="$all_patterns -e $pattern"
if [ $quarter -eq 1 ]; then
((year--))
quarter=4
else
((quarter--))
fi
done
printf -v repos "packethost/packngo
packethost/packet-python
kubernetes-sigs/cluster-api-provider-packet
crossplane-contrib/provider-jet-equinix"
for org in equinix{,-labs}; do
repos="$repos"$'\n'"$(gh repo list $org | cut -f 1)"
done
echo "$repos" | while read repo; do
releases=$(gh release list -R $repo \
| grep $all_patterns) \
&& echo -e "$releases" | sed -E -e "s/^/${repo%%/*}\t${repo#*/}\t/"
# && echo -e "\n$repo\n$releases"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment