@@ -60,8 +60,8 @@ srv.post('/github', async (req, res, next) => {
6060 token = await app . getSignedJsonWebToken ( ) ;
6161 //getPayloadRequest(req) GET /orgs/:org/installation
6262 const { data } = await request ( "GET /repos/:owner/:repo/installation" , {
63- owner : "cortex-lab" ,
64- repo : "Rigbox" ,
63+ owner : process . env . REPO_OWNER ,
64+ repo : process . env . REPO_NAME ,
6565 headers : {
6666 authorization : `Bearer ${ token } ` ,
6767 accept : "application/vnd.github.machine-man-preview+json"
@@ -124,7 +124,7 @@ function compareCoverage(data) {
124124 queue . add ( {
125125 skipPost : true ,
126126 sha : ids [ commit ] ,
127- owner : 'cortex-lab' , // @todo Generalize repo owner
127+ owner : process . env . REPO_OWNER ,
128128 repo : data . repo ,
129129 status : '' ,
130130 context : '' ,
@@ -136,7 +136,7 @@ function compareCoverage(data) {
136136 }
137137 // Post a our coverage status
138138 request ( 'POST /repos/:owner/:repo/statuses/:sha' , {
139- owner : 'cortex-lab' ,
139+ owner : process . env . REPO_OWNER ,
140140 repo : data . repo ,
141141 headers : {
142142 authorization : `token ${ installationAccessToken } ` ,
@@ -146,7 +146,7 @@ function compareCoverage(data) {
146146 state : status ,
147147 target_url : `${ process . env . WEBHOOK_PROXY_URL } /events/${ ids . head } ` , // fail
148148 description : description ,
149- context : 'coverage/ZTEST'
149+ context : 'coverage/ZTEST' // TODO Generalize
150150 } ) ;
151151}
152152
@@ -182,7 +182,7 @@ srv.get('/coverage/:repo/:branch', async (req, res) => {
182182 // Find head commit of branch
183183 try {
184184 const { data } = await request ( 'GET /repos/:owner/:repo/git/refs/heads/:branch' , {
185- owner : 'cortex-lab' , // @todo Generalize repo owner
185+ owner : process . env . REPO_OWNER ,
186186 repo : req . params . repo ,
187187 branch : req . params . branch
188188 } ) ;
@@ -206,7 +206,7 @@ srv.get('/coverage/:repo/:branch', async (req, res) => {
206206 queue . add ( {
207207 skipPost : true ,
208208 sha : id ,
209- owner : 'cortex-lab' , // @todo Generalize repo owner
209+ owner : process . env . REPO_OWNER ,
210210 repo : req . params . repo ,
211211 status : '' ,
212212 context : '' } ) ;
@@ -228,7 +228,7 @@ srv.get('/status/:repo/:branch', async (req, res) => {
228228 // Find head commit of branch
229229 try {
230230 const { data } = await request ( 'GET /repos/:owner/:repo/git/refs/heads/:branch' , {
231- owner : 'cortex-lab' , // @todo Generalize repo owner
231+ owner : process . env . REPO_OWNER ,
232232 repo : req . params . repo ,
233233 branch : req . params . branch
234234 } ) ;
@@ -251,7 +251,7 @@ srv.get('/status/:repo/:branch', async (req, res) => {
251251 queue . add ( {
252252 skipPost : true ,
253253 sha : id ,
254- owner : 'cortex-lab' , // @todo Generalize repo owner
254+ owner : process . env . REPO_OWNER ,
255255 repo : req . params . repo ,
256256 status : '' ,
257257 context : '' } ) ;
@@ -274,7 +274,7 @@ queue.process(async (job, done) => {
274274 // job.id contains id of this job.
275275 var sha = job . data [ 'sha' ] ; // Retrieve commit hash
276276 // If the repo is a submodule, modify path
277- var path = process . env . RIGBOX_REPO_PATH ;
277+ var path = process . env . REPO_PATH ;
278278 if ( job . data [ 'repo' ] === 'alyx-matlab' || job . data [ 'repo' ] === 'signals' ) {
279279 path = path + '\\' + job . data [ 'repo' ] ; }
280280 if ( job . data [ 'repo' ] === 'alyx' ) { sha = 'dev' } // For Alyx checkout master
@@ -365,13 +365,13 @@ queue.on('complete', job => { // On job end post result to API
365365 fs . writeFile ( './db.json' , JSON . stringify ( records ) , function ( err ) {
366366 if ( err ) { console . log ( err ) ; return ; }
367367 // If this test was to ascertain coverage, call comparison function
368- if ( typeof job . data . coverage !== 'undefined' ) { compareCoverage ( job . data ) ; } ;
368+ if ( typeof job . data . coverage !== 'undefined' ) { compareCoverage ( job . data ) ; }
369369 } ) ;
370370 } ) ;
371371} ) ;
372372
373373// Let fail silently: we report error via status
374- queue . on ( 'error' , err => { return ; } ) ;
374+ queue . on ( 'error' , err => { } ) ;
375375// Log handler errors
376376handler . on ( 'error' , function ( err ) {
377377 console . error ( 'Error:' , err . message )
@@ -389,7 +389,7 @@ handler.on('push', async function (event) {
389389 let head_commit = event . payload . head_commit . id ;
390390 // Post a 'pending' status while we do our tests
391391 await request ( 'POST /repos/:owner/:repo/statuses/:sha' , {
392- owner : 'cortex-lab' ,
392+ owner : process . env . REPO_OWNER ,
393393 repo : event . payload . repository . name ,
394394 headers : {
395395 authorization : `token ${ installationAccessToken } ` ,
@@ -404,7 +404,7 @@ handler.on('push', async function (event) {
404404 // Add a new test job to the queue
405405 queue . add ( {
406406 sha : head_commit ,
407- owner : 'cortex-lab' , // @todo Generalize repo owner field
407+ owner : process . env . REPO_OWNER ,
408408 repo : event . payload . repository . name ,
409409 status : '' ,
410410 context : ''
@@ -428,7 +428,7 @@ handler.on('pull_request', async function (event) {
428428 if ( false ) { // TODO for alyx only
429429 // Post a 'pending' status while we do our tests
430430 await request ( 'POST /repos/:owner/:repo/statuses/:sha' , {
431- owner : 'cortex-lab' ,
431+ owner : process . env . REPO_OWNER ,
432432 repo : event . payload . repository . name ,
433433 headers : {
434434 authorization : `token ${ installationAccessToken } ` ,
@@ -444,7 +444,7 @@ handler.on('pull_request', async function (event) {
444444
445445 // Post a 'pending' status while we do our tests
446446 request ( 'POST /repos/:owner/:repo/statuses/:sha' , {
447- owner : 'cortex-lab' ,
447+ owner : process . env . REPO_OWNER ,
448448 repo : event . payload . repository . name ,
449449 headers : {
450450 authorization : `token ${ installationAccessToken } ` ,
0 commit comments