Skip to content

statusToBadge

Maps a CI/CD job status to an inline code badge string.

StatusBadge
success`passing`
failure`failing`
skipped`skipped`
(other)`unknown`

Available since v2.0.0

import { statusToBadge } from '@helpers4/ci';
// or, from the all-in-one package (same code, one install):
import { statusToBadge } from 'helpers4/ci';
statusToBadge(status: CiStatus): string
ParameterTypeDescription
statusCiStatusThe CI/CD job status

string — A Markdown inline-code badge

Returns a Markdown code-span badge string for the given CI status.

statusToBadge('success')  // => '`passing`'
statusToBadge('failure')  // => '`failing`'
statusToBadge('skipped')  // => '`skipped`'
statusToBadge('pending')  // => '`unknown`'

Canonical CI/CD job status values. The string & {} intersection allows any custom status string while still enabling IDE auto-completion for the known values.

type CiStatus = 'success' | 'failure' | 'skipped' | 'unknown' | (string & {})

View source on GitHub