def notify_pull_request(self, text): """ Add comment in associated pull request :param text: Comment body :return: """ github = GitHub() github.post_pull_request_comment(self.repo,self.pull_request_num,text)
def notify_pull_request(self, text): """ Add comment in associated pull request :param text: Comment body :return: """ if self.silent: return github = GitHub() github.post_pull_request_comment(self.repo, self.pull_request_num, text)
def create(self, request, *args, **kwargs): serializer = CreateCompareRequestSerializer(data=request.data, context=self.get_serializer_context()) serializer.is_valid(raise_exception=True) repo_name = serializer.data['repo'] pull_req_num = serializer.data['pull_request_num'] github = GitHub() create_compare_request = CreateCompareRequest(github, repo_name, pull_req_num) try: create_compare_request.execute() except MergeFailed as e: github.post_pull_request_comment(repo_name, pull_req_num, self.get_merge_failed_message()) raise serializer = CompareRequestSerializer(create_compare_request.result, context=self.get_serializer_context()) headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=create_compare_request.http_status, headers=headers)
def create(self, request, *args, **kwargs): serializer = CreateCompareRequestSerializer(data=request.data, context=self.get_serializer_context()) serializer.is_valid(raise_exception=True) repo_name = serializer.data['repo'] pull_req_num = serializer.data['pull_request_num'] silent = serializer.data['silent'] github = GitHub() create_compare_request = CreateCompareRequest(github, repo_name, pull_req_num, silent) try: create_compare_request.execute() except MergeFailed as e: github.post_pull_request_comment(repo_name, pull_req_num, self.get_merge_failed_message()) raise serializer = CompareRequestSerializer(create_compare_request.result, context=self.get_serializer_context()) headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=create_compare_request.http_status, headers=headers)