com web/master: Removing the action (opened/closed/..) from the title: github-webhook.php
| From: | Hannes Magnusson | Date: | Fri, 01 Aug 2014 23:51:48 +0000 |
| Subject: | com web/master: Removing the action (opened/closed/..) from the title: github-webhook.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-19601@lists.php.net to get a copy of this message | ||
Commit: aa6ec67f3b4b41ef494f107085c60d9c7c65011e
Author: Hannes Magnusson <bjori@mongodb.com> Fri, 1 Aug 2014 16:51:48 -0700
Parents: b1aecf8e1944b17de14d52d2e2c9ce989a2a3eaa
Branches: master
Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=aa6ec67f3b4b41ef494f107085c60d9c7c65011e
Log:
Removing the action (opened/closed/..) from the title
It otherwise creates tons of "gmail conversation"
Changed paths:
M github-webhook.php
Diff:
diff --git a/github-webhook.php b/github-webhook.php
index b717c1d..e3097c2 100644
--- a/github-webhook.php
+++ b/github-webhook.php
@@ -21,14 +21,14 @@ function get_repo_email($repos, $repoName) {
return $to;
}
-function prep_title($action, $PR, $base) {
+function prep_title($PR, $base) {
$PRNumber = $PR->number;
$title = $PR->title;
$repoName = $base->repo->name;
$targetBranch = $base->ref;
- $subject = sprintf('[PR][%s][#%s][%s][%s] - %s', $repoName, $PRNumber, $targetBranch,
$action, $title);
+ $subject = sprintf('[PR][%s][#%s][%s] - %s', $repoName, $PRNumber, $targetBranch,
$title);
return $subject;
}
@@ -52,7 +52,6 @@ if (!verify_signature($body)) {
$payload = json_decode($body);
$PR = $payload->pull_request;
-$action = $payload->action;
$htmlUrl = $PR->html_url;
$repoName = $PR->base->repo->name;
$description = $PR->body;
@@ -64,7 +63,7 @@ switch ($_SERVER['HTTP_X_GITHUB_EVENT']) {
$mergeable = $PR->mergeable;
$to = get_repo_email($CONFIG["repos"], $repoName);
- $subject = prep_title($action, $PR, $PR->base);
+ $subject = prep_title($PR, $PR->base);
$message = sprintf("You can view the Pull Request on github:\r\n%s", $htmlUrl);
if ($mergeable === false) {
@@ -80,7 +79,7 @@ switch ($_SERVER['HTTP_X_GITHUB_EVENT']) {
$comment = $payload->comment->body;
$to = get_repo_email($CONFIG["repos"], $repoName);
- $subject = prep_title($action, $PR, $PR->base);
+ $subject = prep_title($PR, $PR->base);
$message = sprintf("You can view the Pull Request on github:\r\n%s", $htmlUrl);
$message .= sprintf("\r\n\r\nPull Request Comment:\r\n%s", $description);
$message .= sprintf("\r\nMade by: %s", $username);