Created
          June 13, 2019 09:41 
        
      - 
      
- 
        Save sbesson/fc62c7c1a6de5f1234c6d93dfb738d9a to your computer and use it in GitHub Desktop. 
    Remove obsolete integration branches
  
        
  
    
      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 python | |
| # Remove obsolete integration branches | |
| import scc.git | |
| import sys | |
| # Login and check the organization | |
| gh = scc.git.get_github(scc.git.get_token()) | |
| print "Authenticated as %s" % gh.get_user().login | |
| branch = sys.argv[1] | |
| refname = 'heads/%s' % branch | |
| for repo in gh.get_user().get_repos(): | |
| try: | |
| ref = repo.get_git_ref(refname) | |
| except Exception, e: | |
| ref = None | |
| if ref is not None: | |
| print "Deleting %s from %s" % (branch, repo.name) | |
| ref.delete() | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment