kopia lustrzana https://github.com/badgen/badgen.net
Update circleci to live badge
rodzic
171cfbccc4
commit
076283a702
|
@ -62,6 +62,7 @@ Available color names:
|
|||
| travis |  | [/travis/amio/micro-cors](/travis/amio/micro-cors)
|
||||
| travis (org) |  | [/travis-org/styfle/packagephobia](/travis-org/styfle/packagephobia)
|
||||
| circleci |  | [/circleci/github/amio/now-go](/circleci/github/amio/now-go)
|
||||
| circleci (branch) |  | [/circleci/github/amio/now-go/master](/circleci/github/amio/now-go/master)
|
||||
| appveyor ci |  | [/appveyor/ci/gruntjs/grunt](/appveyor/ci/gruntjs/grunt)
|
||||
|
||||
## About
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module.exports = {
|
||||
'appveyor': require('./appveyor.js'),
|
||||
'chrome-web-store': require('./chrome-web-store.js'),
|
||||
'circleci': require('./circleci.js'),
|
||||
'crates': require('./crates.js'),
|
||||
'homebrew': require('./homebrew.js'),
|
||||
'npm': require('./npm.js')
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
const axios = require('../axios.js')
|
||||
const qs = require('querystring')
|
||||
|
||||
// https://circleci.com/docs/api/v1-reference/
|
||||
module.exports = async function (vcsType, username, project, branch) {
|
||||
branch = branch ? `/tree/${qs.escape(branch)}` : ''
|
||||
const endpoint = `https://circleci.com/api/v1.1/project/${vcsType}/${username}/${project}${branch}`
|
||||
const [ latest ] = await axios.get(endpoint).then(res => res.data)
|
||||
|
||||
return {
|
||||
subject: 'circleci',
|
||||
status: latest.status,
|
||||
color: latest.status === 'success' ? 'green' : 'red'
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
module.exports = {
|
||||
'circleci': require('./circleci.js'),
|
||||
'travis': require('./travis.js'),
|
||||
'travis-org': require('./travis-org.js')
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
module.exports = function (platform, ...args) {
|
||||
switch (platform) {
|
||||
case 'github':
|
||||
return `https://circleci.com/gh/${args.join('/')}.svg?style=shield`
|
||||
default:
|
||||
return '/badge/circleci/unknown/grey'
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue