Last active
April 13, 2023 06:04
-
-
Save zulhfreelancer/cb5c5879280fd7b3ab3ff356f75c74bd to your computer and use it in GitHub Desktop.
How to bulk delete or leave all Heroku apps using bash script, Heroku CLI and jq?
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
# List all apps | |
heroku apps | |
# Delete all apps created by yourself | |
for app in $(heroku apps --json | jq -r '.[] | select(.owner.email == "<insert-heroku-email-here>") | .name'); do echo $app | heroku apps:destroy $app; done | |
# Leave all apps created by others where you were a collaborator | |
for app in $(heroku apps --json | jq -r '.[] | select(.owner.email != "<insert-heroku-email-here>") | .name'); do heroku apps:leave -a $app; done | |
# List all apps again | |
heroku apps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment