Reputation: 4115
i am trying to make a autodeploy with github, i execute this js to have a "server" to receive the hook from github, that work amazing, but i need then to execute a script to download the repository, but this code don't execute my hook.sh. I don't have experience with node earlier, so, i am lost here.
// Listen on port 9001
var gith = require('gith').create( 9001 );
// Import execFile, to run our bash script
var execFile = require('child_process').execFile;
gith({
repo: 'username/autodeploy'
}).on( 'all', function( payload ) {
if( payload.branch === 'master' )
{
// Exec a shell script
execFile('/root/nodeapp/hook.sh', function(error, stdout, stderr) {
// Log success in some manner
console.log( 'exec complete' );
});
}
});
ok, i was testing this manually and seems that the problem is with gith({.... all that is inside this doesn't work, anyone have an idea?
thanks to everyone
Upvotes: 0
Views: 149
Reputation: 4115
well, the problem was with
gith({
repo: 'username/autodeploy'
}).on( 'all', function( payload ) {....
i changed that for
gith({
repo: 'username/autodeploy'
}).on( 'file:all', function( payload ) {....
and that solved my problem. thanks @mscdex and @alandarev for tell me to test.
Upvotes: 1