fix(travis): support new default branch naming convention

pull/464/head
Dario Vladović 2020-12-18 02:02:15 +00:00 zatwierdzone przez GitHub
rodzic a37cceb2e5
commit 09862c1e32
1 zmienionych plików z 6 dodań i 5 usunięć

Wyświetl plik

@ -12,12 +12,13 @@ export default createBadgenHandler({
}
})
async function handler ({ user, repo, branch = 'master' }: PathArgs) {
const com = `https://api.travis-ci.com/${user}/${repo}.svg?branch=${branch}`
const org = `https://api.travis-ci.org/${user}/${repo}.svg?branch=${branch}`
async function handler ({ user, repo, branch }: PathArgs) {
const badgePath = `${user}/${repo}.svg`
const searchParams = new URLSearchParams()
if (branch) searchParams.append('branch', branch)
const [svg1, svg2] = await Promise.all([
got(com).text(),
got(org).text()
got(badgePath, { prefixUrl: 'https://api.travis-ci.com', searchParams }).text(),
got(badgePath, { prefixUrl: 'https://api.travis-ci.org', searchParams }).text()
])
const result = statuses.find(([status]) => {