from GithubAPIDriver import GithubAPIDriver from GithubLGModule import get_lg_data from CircleCiAPIDriver import CircleCiAPIDriver from StatusPrinter import StatusPrinter import Helper import sys import re circle_driver = CircleCiAPIDriver() github_driver = GithubAPIDriver() printer = StatusPrinter() ################################################################################################### # MAKE SURE LOCAL AND REMOTE BRANCH ARE THE SAME ################################################################################################### printer.print_process('Checking for differences with local branch') commits = github_driver.get_pr_commits() if len(commits) <= 0: printer.print_error("No commits on the pr. Suggestion: push any changes") else: pr_sha = commits[-1]['sha'] local_sha = Helper.local_sha() if pr_sha != local_sha: branch = Helper.current_branch() printer.print_warning("The commit on the pr is different than local. Suggestion: (git push -f origin {0}) or (git pull origin {0})".format(branch)) else: printer.print_check() ################################################################################################### # MAKE SURE MASTER LOCAL AND REMOTE ARE THE SAME ###################################################################################################
from GithubAPIDriver import GithubAPIDriver from WrikeAPIDriver import WrikeAPIDriver from StatusPrinter import StatusPrinter import Helper import re import sys github_driver = GithubAPIDriver() wrike_driver = WrikeAPIDriver() printer = StatusPrinter(70) ################################################################################################### # 'CLICK' MERGE BUTTON ################################################################################################### printer.print_process('Triggering "Merge pull request" button actions') result = github_driver.merge_pr() if result is not None: if result.get('merged') is not None and result['merged'] == True: printer.print_check() else: if result.get('message') is not None: printer.print_error(result['message']) else: printer.print_error('Could not perform merge') sys.exit(-1) else: printer.print_error('Could not find open PR') sys.exit(-1) ################################################################################################### # CLOSE WRIKE TASK
from GithubAPIDriver import GithubAPIDriver import re import webbrowser driver = GithubAPIDriver() issue = driver.get_current_issue() match = re.search('(https://www\.wrike\.com/(?:open\.htm\?)id=[\d\w]+)', issue.get('body') or '') if match is not None: print match.group(1) webbrowser.open(match.group(1)) else: print 'No wrike task address found'