kopia lustrzana https://github.com/badgen/badgen.net
live-fns: report unknown topic on coveralls badge
rodzic
135c2e8664
commit
9d8629b1ba
|
|
@ -2,17 +2,22 @@ const axios = require('../axios.js')
|
|||
const covColor = require('../utils/cov-color.js')
|
||||
|
||||
module.exports = async function (topic, platform, user, repo, branch) {
|
||||
// only support topic="c" fow now
|
||||
|
||||
const query = branch ? `?branch=${branch}` : ''
|
||||
const endpoint = `https://coveralls.io/${platform}/${user}/${repo}.json${query}`
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
const { covered_percent } = await axios.get(endpoint).then(res => res.data)
|
||||
|
||||
return {
|
||||
subject: 'coverage',
|
||||
status: Number(covered_percent.toFixed(1)) + '%',
|
||||
color: covColor(covered_percent)
|
||||
switch (topic) {
|
||||
case 'c':
|
||||
return {
|
||||
subject: 'coverage',
|
||||
status: Number(covered_percent.toFixed(1)) + '%',
|
||||
color: covColor(covered_percent)
|
||||
}
|
||||
default:
|
||||
return {
|
||||
status: 'unknown topic'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue