From 0bb745a56c27d2b96016dd30574236b5378f25b7 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Oct 07 2019 12:21:48 +0000 Subject: Send notification when a branch is created --- diff --git a/pagure/hooks/default.py b/pagure/hooks/default.py index f9f8125..9fae328 100644 --- a/pagure/hooks/default.py +++ b/pagure/hooks/default.py @@ -330,7 +330,7 @@ class DefaultRunner(BaseRunner): refname, oldrev, ) - print("Deleting a tag, so we won't run the " "pagure hook") + print("Deleting a tag, so we won't run the pagure hook") elif refname.startswith("refs/heads/"): refname = refname.replace("refs/heads/", "") send_action_notification( @@ -343,13 +343,11 @@ class DefaultRunner(BaseRunner): refname, oldrev, ) - print( - "Deleting a branch, so we won't run the " "pagure hook" - ) + print("Deleting a branch, so we won't run the pagure hook") else: print( "Deleting %s, so we wont run the pagure hook nor " - "send notifications" + "send notifications" % refname ) continue elif set(oldrev) == set(["0"]): @@ -366,6 +364,18 @@ class DefaultRunner(BaseRunner): refname, newrev, ) + if refname.startswith("refs/heads/"): + refname = refname.replace("refs/heads/", "") + send_action_notification( + session, + "branch", + "creation", + project, + repodir, + username, + refname, + newrev, + ) elif pagure.lib.git.is_forced_push(oldrev, newrev, repodir): forced = True base = pagure.lib.git.get_base_revision(