Created
November 9, 2023 17:17
-
-
Save pevd950/e43d78c305aa10bd5867a2d988bd92d7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| require "json" | |
| require "active_support/all" | |
| codespaces = JSON.parse!(`gh cs list --json name,lastUsedAt`) | |
| codespaces.each do |codespace| | |
| if codespace["lastUsedAt"].to_date < 7.days.ago | |
| puts "Deleting #{codespace["name"]}..." | |
| `gh cs delete --force -c #{codespace["name"]}` | |
| end | |
| end | |
| puts "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment