Created
May 28, 2021 15:32
-
-
Save dedoussis/1dca803d62a0152d97b5df4aee6ddfbc to your computer and use it in GitHub Desktop.
Revisions
-
dedoussis created this gist
May 28, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #!/usr/bin/env python3 """ Clears all deployments from a given repo Requirements: pip install PyGithub Usage: GITHUB_ACCESS_TOKEN=${MY_PAT} REPO_NAME=twbs/bootstrap delete_deployments.py """ from github import Github import os def main(): client = Github(os.environ["GITHUB_ACCESS_TOKEN"]) repo = client.get_repo(os.environ["REPO_NAME"]) for deployment in repo.get_deployments(): headers, data = client._Github__requester.requestJsonAndCheck( "DELETE", deployment.url ) print(headers, data) if __name__ == "__main__": main()