kopia lustrzana https://github.com/badgen/badgen.net
Add appveyor badge v2
rodzic
9f66579538
commit
662bcd25b5
|
@ -0,0 +1,33 @@
|
||||||
|
import got from '../libs/got'
|
||||||
|
import {
|
||||||
|
badgenServe,
|
||||||
|
BadgenServeMeta as Meta,
|
||||||
|
BadgenServeHandlers as Handlers,
|
||||||
|
BadgenServeHandlerArgs as Args
|
||||||
|
} from '../libs/badgen-serve'
|
||||||
|
|
||||||
|
export const meta: Meta = {
|
||||||
|
title: 'AppVeyor',
|
||||||
|
examples: {
|
||||||
|
'/appveyor/ci/gruntjs/grunt': 'build',
|
||||||
|
'/appveyor/ci/gruntjs/grunt/deprecate': 'build (branch)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const handlers: Handlers = {
|
||||||
|
'/appveyor/ci/:account/:project/:branch?': handler
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handler ({ account, project, branch }: Args) {
|
||||||
|
branch = branch ? `/branch/${branch}` : ''
|
||||||
|
const endpoint = `https://ci.appveyor.com/api/projects/${account}/${project}${branch}`
|
||||||
|
const { build } = await got(endpoint).then(res => res.body)
|
||||||
|
|
||||||
|
return {
|
||||||
|
subject: 'appveyor',
|
||||||
|
status: build.status,
|
||||||
|
color: build.status === 'success' ? 'green' : 'red'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default badgenServe(handlers)
|
|
@ -6,6 +6,7 @@ const rel = (...args) => path.resolve(__dirname, ...args)
|
||||||
// sort live badge examples manually
|
// sort live badge examples manually
|
||||||
const liveBadgeExampleList = [
|
const liveBadgeExampleList = [
|
||||||
'github',
|
'github',
|
||||||
|
'appveyor',
|
||||||
'amo',
|
'amo',
|
||||||
'apm',
|
'apm',
|
||||||
'homebrew'
|
'homebrew'
|
||||||
|
|
Ładowanie…
Reference in New Issue