Author: Nikita Popov (nikic)
Date: 2021-05-14T10:23:53+02:00

Commit: 
https://github.com/php/web-master/commit/acf9f2060aad24573df8217f17bed3e53f1d1385
Raw diff: 
https://github.com/php/web-master/commit/acf9f2060aad24573df8217f17bed3e53f1d1385.diff

Don't send commit mails for force-pushed branches

Changed paths:
  M  public/github-webhook.php


Diff:

diff --git a/public/github-webhook.php b/public/github-webhook.php
index d906a90..56ca6ca 100644
--- a/public/github-webhook.php
+++ b/public/github-webhook.php
@@ -191,6 +191,10 @@ function handle_ref_change_mail($mailingList, $payload) {
         $message .= "Tag: 
https://github.com/php/$repoName/releases/tag/$refName\n";;
     }
 
+    if ($payload->forced) {
+        $message .= "\nCommit mails will not be sent for force-pushed 
commits!\n";
+    }
+
     send_mail($mailingList, $subject, $message, 
MailAddress::noReply($pusherName));
 }
 
@@ -285,6 +289,12 @@ function handle_push_mail($payload) {
         handle_ref_change_mail($mailingList, $payload);
     }
 
+    if ($payload->forced) {
+        // Do not send commit mails for force-pushed branches. These are 
generally rebases
+        // of existing commits and cause a lot of noise.
+        return;
+    }
+
     $dbh = DB::connect();
 
     $pusherName = $payload->pusher->name;

-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to