File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2308,6 +2308,7 @@ exports.webhook = function (aReq, aRes) {
23082308 var repos = { } ;
23092309 var repo = null ;
23102310 var update = null ;
2311+ var defaultBranch = null ;
23112312
23122313 // Return if script storage is in read-only mode
23132314 if ( process . env . READ_ONLY_SCRIPT_STORAGE === 'true' ) {
@@ -2375,9 +2376,10 @@ exports.webhook = function (aReq, aRes) {
23752376
23762377 //
23772378
2378- // Only accept commits from the `master` branch
2379- if ( payload . ref !== 'refs/heads/master' ) {
2380- aRes . status ( 403 ) . send ( 'Default branch is not `master`.' ) ; // Forbidden
2379+ // Only accept commits from the repository's default branch
2380+ defaultBranch = ( payload . repository && payload . repository . default_branch ) || 'master' ;
2381+ if ( payload . ref !== 'refs/heads/' + defaultBranch ) {
2382+ aRes . status ( 403 ) . send ( 'Push is not to default branch.' ) ; // Forbidden
23812383 return ;
23822384 }
23832385
You can’t perform that action at this time.
0 commit comments