Last active
October 4, 2023 09:53
-
-
Save ekohl/cb6a252b34c7093fb0ef1b439a95e54f to your computer and use it in GitHub Desktop.
Revisions
-
ekohl revised this gist
Oct 4, 2023 . 1 changed file with 8 additions and 3 deletions.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 @@ -9,6 +9,9 @@ 'https://notify.travis-ci.org', 'https://ossistant-inecas.rhcloud.com', ) TO_KEEP = ( 'https://ci.theforeman.org', ) GITHUB_ORG = 'theforeman' GITHUB_TOKEN = os.environ['GITHUB_TOKEN'] @@ -21,7 +24,9 @@ for hook in repo.get_hooks(): url = hook.config['url'] if url.startswith(TO_CLEAN): print(f'{repo.name}: Removing {url}') hook.delete() elif url.startswith(TO_KEEP): pass else: print(f'{repo.name}: Keeping {url}') -
ekohl created this gist
Oct 4, 2023 .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 import os from github import Github TO_CLEAN = ( 'https://prprocessor.theforeman.org', 'https://notify.travis-ci.org', 'https://ossistant-inecas.rhcloud.com', ) GITHUB_ORG = 'theforeman' GITHUB_TOKEN = os.environ['GITHUB_TOKEN'] g = Github(GITHUB_TOKEN) org = g.get_organization(GITHUB_ORG) for repo in org.get_repos(): if not repo.archived: for hook in repo.get_hooks(): url = hook.config['url'] if url.startswith(TO_CLEAN): print(f'{repo.name}: Would remove {url}') #hook.delete() else: print(f'{repo.name}: Would keep {url}')