diff --git a/app/blueprints/github/__init__.py b/app/blueprints/github/__init__.py
index 46741707..f5962b63 100644
--- a/app/blueprints/github/__init__.py
+++ b/app/blueprints/github/__init__.py
@@ -134,6 +134,10 @@ def webhook():
if event == "push":
ref = json["after"]
title = json["head_commit"]["message"].partition("\n")[0]
+ branch = json["ref"].replace("refs/heads/", "")
+ if branch not in [ "master", "main" ]:
+ return jsonify({ "success": False, "message": "Webhook ignored, as it's not on the master/main branch" })
+
elif event == "create" and json["ref_type"] == "tag":
ref = json["ref"]
title = ref
diff --git a/app/blueprints/gitlab/__init__.py b/app/blueprints/gitlab/__init__.py
index 990aee64..a0babc60 100644
--- a/app/blueprints/gitlab/__init__.py
+++ b/app/blueprints/gitlab/__init__.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see
- "New commit" or "push" based webhooks are currently broken as they don't check the branch name. - This means that releases will be created for pushes to non-default branches. + "New commit" or "push" based webhooks will currently only work on branches named `master` or + `main`.
## Setting up