From 1be141257075b6fa9954902e71aa3c66c311cb04 Mon Sep 17 00:00:00 2001 From: Peter Siska Date: Thu, 30 Jun 2016 16:43:24 +0200 Subject: [PATCH] Add a slack_skip_notification environment variable to disable notifications in the slack task --- docs/slack.md | 4 ++++ slack.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/slack.md b/docs/slack.md index cc76213..f55d2e6 100644 --- a/docs/slack.md +++ b/docs/slack.md @@ -8,6 +8,10 @@ require 'vendor/deployer/recipes/slack.php'; ``` +### Environmental variables + +- **slack_skip_notification** - Skips the entire task when set to `true`. This is particularly useful if you want to disable slack notifications for certain stages. + ### Configuration options - **slack** *(required)*: accepts an *array* with the api token and team name. Token can be generated on [slack api website](https://api.slack.com/docs/oauth-test-tokens). diff --git a/slack.php b/slack.php index 2ec93ce..1a1c714 100644 --- a/slack.php +++ b/slack.php @@ -18,6 +18,10 @@ desc('Notifying Slack channel of deployment'); task('deploy:slack', function () { + if (true === env('slack_skip_notification')) { + return; + } + global $php_errormsg; $defaultConfig = [