Amio /
6 years ago
committed by
GitHub
6 changed files with 37 additions and 5 deletions
@ -0,0 +1,32 @@ |
|||
const axios = require('../axios.js') |
|||
|
|||
module.exports = async function (user, repo, branch = 'master') { |
|||
const com = `https://api.travis-ci.com/${user}/${repo}.svg?branch=${branch}` |
|||
const org = `https://api.travis-ci.org/${user}/${repo}.svg?branch=${branch}` |
|||
const results = await Promise.all([ |
|||
axios.get(com).then(res => res.data).catch(e => e), |
|||
axios.get(org).then(res => res.data).catch(e => e) |
|||
]) |
|||
|
|||
if (results[0].match('passing') || results[1].match('passing')) { |
|||
return { |
|||
subject: 'build', |
|||
status: 'passing', |
|||
color: 'green' |
|||
} |
|||
} |
|||
|
|||
if (results[0].match('failed') || results[1].match('failed')) { |
|||
return { |
|||
subject: 'build', |
|||
status: 'failed', |
|||
color: 'red' |
|||
} |
|||
} |
|||
|
|||
return { |
|||
subject: 'build', |
|||
status: 'unknown', |
|||
color: 'grey' |
|||
} |
|||
} |
@ -1,4 +1,4 @@ |
|||
module.exports = { |
|||
'travis': require('./travis.js'), |
|||
// 'travis': require('./travis.js'),
|
|||
'travis-org': require('./travis-org.js') |
|||
} |
|||
|
@ -1,3 +1,4 @@ |
|||
module.exports = function (...args) { |
|||
console.log('travis-org', args.join('/')) |
|||
return `https://api.travis-ci.org/${args.join('/')}.svg?branch=master` |
|||
} |
|||
|
@ -1,3 +0,0 @@ |
|||
module.exports = function (...args) { |
|||
return `https://api.travis-ci.com/${args.join('/')}.svg?branch=master` |
|||
} |
Loading…
Reference in new issue