(
github: GithubApi,
comment: TerraformComment,
*,
headers: dict[str, str] = None,
description: str = None,
summary: str = None,
body: str = None,
status: str = None,
body_highlighting: str = None
)
| 345 | |
| 346 | |
| 347 | def update_comment( |
| 348 | github: GithubApi, |
| 349 | comment: TerraformComment, |
| 350 | *, |
| 351 | headers: dict[str, str] = None, |
| 352 | description: str = None, |
| 353 | summary: str = None, |
| 354 | body: str = None, |
| 355 | status: str = None, |
| 356 | body_highlighting: str = None |
| 357 | ) -> TerraformComment: |
| 358 | |
| 359 | new_headers = headers if headers is not None else comment.headers |
| 360 | new_headers['version'] = version |
| 361 | |
| 362 | new_comment = TerraformComment( |
| 363 | issue_url=comment.issue_url, |
| 364 | comment_url=comment.comment_url, |
| 365 | node_id=comment.node_id, |
| 366 | headers=new_headers, |
| 367 | description=description if description is not None else comment.description, |
| 368 | summary=summary if summary is not None else comment.summary, |
| 369 | body=body if body is not None else comment.body, |
| 370 | body_highlighting=body_highlighting if body_highlighting is not None else comment.body_highlighting, |
| 371 | status=status if status is not None else comment.status |
| 372 | ) |
| 373 | |
| 374 | if comment.comment_url is not None: |
| 375 | response = github.patch(comment.comment_url, json={'body': _to_api_payload(new_comment)}) |
| 376 | response.raise_for_status() |
| 377 | if comment.node_id is None: |
| 378 | comment.node_id = response.json().get('node_id') |
| 379 | else: |
| 380 | response = github.post(comment.issue_url + '/comments', json={'body': _to_api_payload(new_comment)}) |
| 381 | response.raise_for_status() |
| 382 | new_comment.comment_url = response.json()['url'] |
| 383 | new_comment.node_id = response.json().get('node_id') |
| 384 | |
| 385 | return new_comment |
| 386 | |
| 387 | def hide_comment( |
| 388 | github: GithubApi, |
no test coverage detected