def get_commits(bot_input, bot_output): gh = GithubHelper(bot_input, bot_output) team = gh.get_team() team_repos = team.get_repos() random_repo = team_repos[random.randrange(0,3)] start_date = moment.now().add(key='days',amount=-30).date commits = random_repo.get_commits(since=start_date) return commits
def create_pull_request(bot_input, bot_output, story): story_number = str(story["Id"]) url = "https://daptiv.tpondemand.com/entity/{0}".format(story_number) bot_output.say("Creating PR for [{0}]({1})".format(story["Name"], url)) gh = GithubHelper(bot_input, bot_output) new_pull_request = gh.create_pull_request_from_partial_name(story_number) if new_pull_request: response = "PR for branch {0} created - [{1}]({2})".format( new_pull_request.title, new_pull_request.title, new_pull_request.html_url) bot_output.say(response) return new_pull_request.html_url else: bot_output.say("No branch found for story {0}".format(story_number))