Created
November 10, 2010 10:01
-
-
Save leonbarrett/670636 to your computer and use it in GitHub Desktop.
Two CodeIgniter methods that you can use to get your Beanstalk deploy notifications into Notify.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pre(){ | |
$this->load->library('notifyio_api'); | |
$handle = fopen('php://input','r'); | |
$jsonInput = fgets($handle); | |
$decoded = json_decode($jsonInput,true); | |
fclose($handle); | |
$data = array( | |
'email'=>$decoded['author_email'], | |
'text'=>'Revision ('.$decoded['revision'].') started for ['.$decoded['repository'].'] to ['.$decoded['server'].']', | |
'title'=>'Deployment Started', | |
'link'=>$decoded['repository_url'], | |
'icon'=>YOUR ICON | |
); | |
$this->notifyio_api->send_notification($data); | |
} | |
function post(){ | |
$this->load->library('notifyio_api'); | |
date_default_timezone_set('Europe/London'); | |
$handle = fopen('php://input','r'); | |
$jsonInput = fgets($handle); | |
$decoded = json_decode($jsonInput,true); | |
fclose($handle); | |
$deploy_time = date("H:i",strtotime($decoded['deployed_at'])); | |
$data = array( | |
'email'=>$decoded['author_email'], | |
'text'=>'Revision ('.$decoded['revision'].') finished for ['.$decoded['repository'].'] to ['.$decoded['server'].'] ('.$deploy_time.')', | |
'title'=>'Deployment Finished', | |
'link'=>$decoded['repository_url'], | |
'icon'=>YOUR ICON | |
); | |
$this->notifyio_api->send_notification($data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment