Add appveyor badge v2

pull/282/head
Amio 2019-05-26 13:23:36 +08:00
rodzic 9f66579538
commit 662bcd25b5
2 zmienionych plików z 34 dodań i 0 usunięć

Wyświetl plik

@ -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)

Wyświetl plik

@ -6,6 +6,7 @@ const rel = (...args) => path.resolve(__dirname, ...args)
// sort live badge examples manually
const liveBadgeExampleList = [
'github',
'appveyor',
'amo',
'apm',
'homebrew'