|
30 | 30 | from sentry.integrations.github.webhook_types import ( |
31 | 31 | GITHUB_WEBHOOK_TYPE_HEADER_KEY, |
32 | 32 | GithubWebhookType, |
33 | | - InstallationRepositoriesEvent, |
34 | 33 | ) |
35 | 34 | from sentry.integrations.pipeline import ensure_integration |
36 | 35 | from sentry.integrations.services.integration.model import ( |
@@ -419,57 +418,6 @@ def _handle_organization_deletion( |
419 | 418 | ) |
420 | 419 |
|
421 | 420 |
|
422 | | -class InstallationRepositoriesEventWebhook(GitHubWebhook): |
423 | | - """ |
424 | | - Handles installation_repositories events when repos are added to or |
425 | | - removed from the GitHub App installation. Runs in control silo. |
426 | | -
|
427 | | - https://docs.github.com/en/webhooks/webhook-events-and-payloads#installation_repositories |
428 | | - """ |
429 | | - |
430 | | - EVENT_TYPE = IntegrationWebhookEventType.INSTALLATION_REPOSITORIES |
431 | | - |
432 | | - def __call__( # type: ignore[override] |
433 | | - self, event: InstallationRepositoriesEvent, host: str | None = None, **kwargs: Any |
434 | | - ) -> None: |
435 | | - external_id = get_github_external_id(event=event, host=host) |
436 | | - if external_id is None: |
437 | | - return |
438 | | - |
439 | | - result = integration_service.organization_contexts( |
440 | | - provider=self.provider, |
441 | | - external_id=external_id, |
442 | | - ) |
443 | | - integration = result.integration |
444 | | - |
445 | | - if integration is None: |
446 | | - logger.warning( |
447 | | - "github.installation_repositories.missing_integration", |
448 | | - extra={"external_id": str(external_id)}, |
449 | | - ) |
450 | | - return |
451 | | - |
452 | | - action = event["action"] |
453 | | - repos_added = event["repositories_added"] |
454 | | - repos_removed = event["repositories_removed"] |
455 | | - repository_selection = event["repository_selection"] |
456 | | - |
457 | | - if not repos_added and not repos_removed: |
458 | | - return |
459 | | - |
460 | | - from .tasks.sync_repos_on_install_change import sync_repos_on_install_change |
461 | | - |
462 | | - sync_repos_on_install_change.apply_async( |
463 | | - kwargs={ |
464 | | - "integration_id": integration.id, |
465 | | - "action": action, |
466 | | - "repos_added": repos_added, |
467 | | - "repos_removed": repos_removed, |
468 | | - "repository_selection": repository_selection, |
469 | | - } |
470 | | - ) |
471 | | - |
472 | | - |
473 | 421 | class PushEventWebhook(GitHubWebhook): |
474 | 422 | """https://developer.github.com/v3/activity/events/types/#pushevent""" |
475 | 423 |
|
@@ -1010,7 +958,6 @@ class GitHubIntegrationsWebhookEndpoint(Endpoint): |
1010 | 958 | _handlers: dict[GithubWebhookType, type[GitHubWebhook]] = { |
1011 | 959 | GithubWebhookType.CHECK_RUN: CheckRunEventWebhook, |
1012 | 960 | GithubWebhookType.INSTALLATION: InstallationEventWebhook, |
1013 | | - GithubWebhookType.INSTALLATION_REPOSITORIES: InstallationRepositoriesEventWebhook, |
1014 | 961 | GithubWebhookType.ISSUE: IssuesEventWebhook, |
1015 | 962 | GithubWebhookType.ISSUE_COMMENT: IssueCommentEventWebhook, |
1016 | 963 | GithubWebhookType.PULL_REQUEST: PullRequestEventWebhook, |
|
0 commit comments