Created
December 6, 2012 14:29
-
-
Save barberj/4224818 to your computer and use it in GitHub Desktop.
.forgitrc file providing Pictage Specific prune hook
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/python | |
def prune_hook(branch): | |
import requests | |
import re | |
match = re.match('sq-([0-9]+).*', branch) | |
if not match: | |
print('Unable to find jira ticket for branch {}'.format(branch)) | |
return False | |
ticket_num = match.groups()[0] | |
rsp = requests.get('https://jira.pictage.com/browse/SQ-{}'.format(ticket_num), verify=False) | |
if rsp.status_code != 200: | |
print('{} response from jira while requesting status for SQ-{}'.format(rsp.status_code, ticket_num)) | |
return False | |
if 'Closed - The issue is considered finished' in rsp.text: | |
return True | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment