def maybe_automerge_pull_request(pull_request: PullRequest) -> bool: if _is_pull_request_ready_for_automerge(pull_request): logger.info( f"Pull request {pull_request.id()} is able to be automerged, automerging now" ) github_client.merge_pull_request( pull_request.repository_owner_handle(), pull_request.repository_name(), pull_request.number(), pull_request.title(), pull_request.body(), ) return True else: return False
def _task_name_from_pull_request(pull_request: PullRequest) -> str: return "#{} - {}".format(pull_request.number(), pull_request.title())