diff --git a/readthedocs/projects/tasks/builds.py b/readthedocs/projects/tasks/builds.py index 4acf845887e..94286e74c61 100644 --- a/readthedocs/projects/tasks/builds.py +++ b/readthedocs/projects/tasks/builds.py @@ -228,6 +228,12 @@ class UpdateDocsTask(SyncRepositoryMixin, Task): YAMLParseError, ) + # Do not send notifications on failure builds for these exceptions. + exceptions_without_notifications = ( + DuplicatedBuildError, + ProjectBuildsSkippedError, + ) + acks_late = True track_started = True @@ -394,11 +400,12 @@ def on_failure(self, exc, task_id, args, kwargs, einfo): ) # Send notifications for unhandled errors - self.send_notifications( - self.data.version.pk, - self.data.build['id'], - event=WebHookEvent.BUILD_FAILED, - ) + if not isinstance(exc, self.exceptions_without_notifications): + self.send_notifications( + self.data.version.pk, + self.data.build['id'], + event=WebHookEvent.BUILD_FAILED, + ) # NOTE: why we wouldn't have `self.data.build_commit` here? # This attribute is set when we get it after clonning the repository