diff --git a/webhook_handlers/views/github.py b/webhook_handlers/views/github.py index 76e7c4dde2..2cdcf8bf84 100644 --- a/webhook_handlers/views/github.py +++ b/webhook_handlers/views/github.py @@ -249,6 +249,20 @@ def push(self, request, *args, **kwargs): ) return Response(data=WebhookHandlerErrorMessages.SKIP_NOT_ACTIVE) + push_webhook_ignore_repos = get_config( + "setup", "push_webhook_ignore_repo_names", default=[] + ) + if repo.name in push_webhook_ignore_repos: + log.debug( + "Codecov is configured to ignore this repository name", + extra=dict( + repoid=repo.repoid, + github_webhook_event=self.event, + repo_name=repo.name, + ), + ) + return Response(data=WebhookHandlerErrorMessages.SKIP_WEBHOOK_IGNORED) + branch_name = self.request.data.get("ref")[11:] commits = self.request.data.get("commits", []) @@ -444,11 +458,11 @@ def _handle_installation_events( if action == "deleted": if event == GitHubWebhookEvents.INSTALLATION: - ghapp_installation: Optional[ - GithubAppInstallation - ] = owner.github_app_installations.filter( - installation_id=installation_id - ).first() + ghapp_installation: Optional[GithubAppInstallation] = ( + owner.github_app_installations.filter( + installation_id=installation_id + ).first() + ) if ghapp_installation is not None: ghapp_installation.delete() # Deprecated flow - BEGIN