From 63204575ebdca86716aef4f03c660ac9d12b745a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 4 Feb 2021 19:54:26 +0000 Subject: [PATCH] Prevent duplicate commit releases from webhooks --- app/blueprints/github/__init__.py | 3 +++ app/blueprints/gitlab/__init__.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/blueprints/github/__init__.py b/app/blueprints/github/__init__.py index 081ef9ee..46741707 100644 --- a/app/blueprints/github/__init__.py +++ b/app/blueprints/github/__init__.py @@ -146,4 +146,7 @@ def webhook(): # Perform release # + if package.releases.filter_by(commit_hash=ref).count() > 0: + return + return api_create_vcs_release(actual_token, package, title, ref, reason="Webhook") diff --git a/app/blueprints/gitlab/__init__.py b/app/blueprints/gitlab/__init__.py index bbe32192..990aee64 100644 --- a/app/blueprints/gitlab/__init__.py +++ b/app/blueprints/gitlab/__init__.py @@ -63,6 +63,9 @@ def webhook_impl(): # Perform release # + if package.releases.filter_by(commit_hash=ref).count() > 0: + return + return api_create_vcs_release(token, package, title, ref, reason="Webhook")