Skip to content

ref(github): PR comment workflow #89969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2025

Conversation

jianyuan
Copy link
Contributor

@jianyuan jianyuan commented Apr 21, 2025

Make the PR comment workflow generic. Migrate the GitHub integration to utilize it.

This PR is built on top of #89683.

@jianyuan jianyuan requested review from a team as code owners April 21, 2025 10:26
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 21, 2025
@jianyuan jianyuan force-pushed the ref/github-pr-comment-workflow branch from 04a1f86 to 08c1d6d Compare April 21, 2025 18:28
def format_comment_url(url: str, referrer: str) -> str:
return url + "?referrer=" + referrer

def get_comment_body(self, issue_ids: list[int]) -> str:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously split into two methods which I've decided to combine so that it is easier to implement for each integration.

issue_comment_contents = get_comment_contents(top_5_issue_ids)
# ...
comment_body = format_comment(issue_comment_contents)

@iamrajjoshi iamrajjoshi added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Apr 21, 2025
return raw_snql_query(request, referrer=self.referrer.value)["data"]


def run_pr_comment_workflow(integration_name: str, pr_id: int, project_id: int) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move the run_pr_comment_workflow function logic into the task itself? i don't think we need it to live as a separate function if it only is run in the task

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cathteng did you mean src/sentry/integrations/github/tasks/pr_comment.py or somewhere else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please, since that task is only calling this function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cathteng Ah, my plan is to make it generic so that it can be used by other integrations as well (i.e., GitLab, Bitbucket, Azure).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be generic because we are using functions from the installation which would be implemented by other providers, right?

@github-actions github-actions bot removed the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Apr 21, 2025
@jianyuan jianyuan force-pushed the ref/github-pr-comment-workflow branch from f1f4651 to 942dd2f Compare April 22, 2025 16:14
@jianyuan jianyuan requested a review from a team as a code owner April 22, 2025 16:14
@cathteng cathteng added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Apr 22, 2025
@cathteng cathteng merged commit fba3f40 into getsentry:master Apr 22, 2025
62 of 64 checks passed
@jianyuan jianyuan deleted the ref/github-pr-comment-workflow branch April 23, 2025 09:27
Copy link

sentry-io bot commented Apr 28, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ RateLimitExceeded: Query on could not be run due to allocation policies, info: {'details': {'ConcurrentRateLimitAllocationPolicy': {'can_run': False, 'max_threads': 0, 'explanation': {'reason': 'concurrent policy 19 exceeds limit of 18', 'overrides': {}, 'storage_key': 'S... sentry.integrations.source_code_management.task... View Issue

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot locked and limited conversation to collaborators May 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants