Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow for pushes to multiple branches

  • Loading branch information...
commit 38e88da2da37c6e6fb4bcf137bde58d0c6f1c858 1 parent ab43872
@jbuck jbuck authored
Showing with 13 additions and 5 deletions.
  1. +13 −5 lib/server.js
View
18 lib/server.js
@@ -121,6 +121,11 @@ function runJob(jobInfo, callback) {
scriptPath = shell.pwd()+'/on_'+jobInfo.event+'.js',
commandLine = 'node '+scriptPath+' > '+outputPath;
+ if (jobInfo.event === 'push' && jobInfo.head_ref !== 'master') {
+ scriptPath = shell.pwd()+'/on_push_to_'+jobInfo.head_ref+'.js';
+ commandLine = 'node '+scriptPath+' > '+outputPath;
+ }
+
shell.mkdir('-p', jobInfo.public_dir);
shell.mkdir('-p', jobInfo.private_dir);
@@ -333,18 +338,21 @@ app.post('/', function(req, res) {
}
}); // postComment()
}; // maybeEnqueueJob()
+ break;
//
// Event: push
//
case 'push':
- if (payload.ref !== 'refs/heads/master') {
- debug('push event not to master branch ('+payload.ref+'). skipping req');
+ var ref = payload.ref.split('/')[2];
+
+ if (ref === 'master' && !shell.test('-f', './on_push.js')) {
+ log('Command not implemented (push)');
return;
}
- if (!shell.test('-f', './on_push.js')) {
- log('Command not implemented (push)');
+ if (ref !== 'master' && !shell.test('-f', './on_push_to_' + ref + '.js')) {
+ log('Command not implemented (push_to_' + ref + ')');
return;
}
@@ -358,7 +366,7 @@ app.post('/', function(req, res) {
public_url: 'http://'+config.host+':'+config.port+'/'+id,
base_url: null,
head_url: 'git://github.com/'+config.repo+'.git',
- head_ref: 'master',
+ head_ref: ref,
head_sha: payload.head_commit.id,
debug: global.debug
};
Please sign in to comment.
Something went wrong with that request. Please try again.