Skip to content

Commit

Permalink
2876 remove copilot btn from ba pr comment fr (#454)
Browse files Browse the repository at this point in the history
* Add conditional based on upload type

* Adjust typing for additional data

* lint

* Add TR to copilot comment exception

* Add gate to not show copilot button
  • Loading branch information
adrian-codecov authored Dec 13, 2024
1 parent b9d7171 commit 0363e7f
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions shared/torngit/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,30 +611,29 @@ async def build_comment_request_body(
self, body: dict, issueid: int | None = None
) -> dict:
body = dict(body=body)
if (
self.data.get("additional_data", {}).get("upload_type")
!= UploadType.BUNDLE_ANALYSIS
):
try:
ownerid = self.data["owner"].get("ownerid")
if (
issueid is not None
and await INCLUDE_GITHUB_COMMENT_ACTIONS_BY_OWNER.check_value_async(
identifier=ownerid, default=False
)
):
bot_name = get_config(
"github", "comment_action_bot_name", default="sentry"
)
body["actions"] = [
{
"name": "Generate Unit Tests",
"type": "copilot-chat",
"prompt": f"@{bot_name} generate tests for this PR.",
}
]
except Exception:
pass
upload_type = self.data.get("additional_data", {}).get("upload_type")
if upload_type in [UploadType.BUNDLE_ANALYSIS, UploadType.TEST_RESULTS]:
return body
try:
ownerid = self.data["owner"].get("ownerid")
if (
issueid is not None
and await INCLUDE_GITHUB_COMMENT_ACTIONS_BY_OWNER.check_value_async(
identifier=ownerid, default=False
)
):
bot_name = get_config(
"github", "comment_action_bot_name", default="sentry"
)
body["actions"] = [
{
"name": "Generate Unit Tests",
"type": "copilot-chat",
"prompt": f"@{bot_name} generate tests for this PR.",
}
]
except Exception:
pass

return body

Expand Down

0 comments on commit 0363e7f

Please sign in to comment.