@@ -293,8 +293,8 @@ handler.on('push', async function (event) {
293293 console . log ( 'Received a push event for %s to %s' ,
294294 event . payload . repository . name ,
295295 event . payload . ref )
296- for ( commit of event . payload . commits ) { // For each commit pushed...
297- try {
296+ try { // Run tests for head commit only
297+ let head_commit = event . payload . head_commit . id ;
298298 // Post a 'pending' status while we do our tests
299299 await request ( 'POST /repos/:owner/:repo/statuses/:sha' , {
300300 owner : 'cortex-lab' ,
@@ -303,22 +303,21 @@ handler.on('push', async function (event) {
303303 authorization : `token ${ installationAccessToken } ` ,
304304 accept : 'application/vnd.github.machine-man-preview+json'
305305 } ,
306- sha : commit [ 'id' ] ,
306+ sha : head_commit ,
307307 state : 'pending' ,
308- target_url : `${ process . env . WEBHOOK_PROXY_URL } /events/${ commit . id } ` , // fail
308+ target_url : `${ process . env . WEBHOOK_PROXY_URL } /events/${ head_commit } ` , // fail
309309 description : 'Tests error' ,
310310 context : 'continuous-integration/ZTEST'
311311 } ) ;
312312 // Add a new test job to the queue
313313 queue . add ( {
314- sha : commit [ 'id' ] ,
314+ sha : head_commit ,
315315 owner : 'cortex-lab' , // @todo Generalize repo owner field
316316 repo : event . payload . repository . name ,
317317 status : '' ,
318318 context : ''
319319 } ) ;
320- } catch ( error ) { console . log ( error ) }
321- } ;
320+ } catch ( error ) { console . log ( error ) }
322321} ) ;
323322
324323// Start the server in the port 3000
0 commit comments