get('mattermost_text'), 'username' => get('mattermost_username'), ]; if (get('mattermost_channel')) { $body['channel'] = get('mattermost_channel'); } if (get('mattermost_icon_url')) { $body['icon_url'] = get('mattermost_icon_url'); } Httpie::post(get('mattermost_webhook'))->jsonBody($body)->send(); }); desc('Notifies mattermost about deploy finish'); task('mattermost:notify:success', function() { if (null === get('mattermost_webhook')) { return; } $body = [ 'text' => get('mattermost_success_text'), 'username' => get('mattermost_username'), ]; if (get('mattermost_channel')) { $body['channel'] = get('mattermost_channel'); } if (get('mattermost_icon_url')) { $body['icon_url'] = get('mattermost_icon_url'); } Httpie::post(get('mattermost_webhook'))->jsonBody($body)->send(); }); desc('Notifies mattermost about deploy failure'); task('mattermost:notify:failure', function() { if (null === get('mattermost_webhook')) { return; } $body = [ 'text' => get('mattermost_failure_text'), 'username' => get('mattermost_username'), ]; if (get('mattermost_channel')) { $body['channel'] = get('mattermost_channel'); } if (get('mattermost_icon_url')) { $body['icon_url'] = get('mattermost_icon_url'); } Httpie::post(get('mattermost_webhook'))->jsonBody($body)->send(); });