Skip to content

Instantly share code, notes, and snippets.

@SophiaH67
Created June 28, 2023 09:49
Show Gist options
  • Save SophiaH67/05878af5b5effffcf5ec78188e75547c to your computer and use it in GitHub Desktop.
Save SophiaH67/05878af5b5effffcf5ec78188e75547c to your computer and use it in GitHub Desktop.
# I really messed up and set up renovate on all my personal account projects...
# This script loops through all repos of your github account and declines the PRs titled "Configure Renovate" to fix this!
# Dependencies for this script are awk and the github cli(also need to be logged in :P)
# Get all repos from my github account using the github cli
for repo in $(gh repo list --limit 1000 --source | awk '{print $1}'); do
# Get all open PRs for the repo
for pr in $(gh pr list --limit 1000 --repo $repo --state open | awk '{print $1}'); do
# Get the PR title
title=$(gh pr --repo $repo view $pr --json title | jq -r '.title')
# If the PR title is "Configure Renovate" then decline the PR
if [ "$title" = "Configure Renovate" ]; then
echo "Declining PR $pr for repo $repo"
gh pr close $pr --repo $repo
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment