Skip to content

Instantly share code, notes, and snippets.

@bashbunni
Created August 14, 2024 20:32
Show Gist options
  • Save bashbunni/30d3596046bf954ba9a266a8d3371e7d to your computer and use it in GitHub Desktop.
Save bashbunni/30d3596046bf954ba9a266a8d3371e7d to your computer and use it in GitHub Desktop.
Use GitHub CLI to check for overdue releases
#!/usr/bin/env sh
# Run this script in the directory that contains repos whose release dates you
# want to check.
for dir in */; do
# check if it's a git repo
cd $PWD/$dir
if [ -d ".git" ]; then
latest=$(gh release ls | grep "Latest")
# check if it has a latest release
if [[ $latest ]]; then
needs_release=$(date -v-2m '+%Y-%m-%d')
# check if it was more than a couple of months ago
release_date=$(echo $latest | grep -Eo "[0-9]{4}\-[0-9]{2}\-[0-9]{2}")
if [[ "${needs_release}" > "${release_date}" ]]; then
echo $dir
echo $latest
fi
fi
fi
cd ../
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment