Files
jNulljandPierre-Yves Bigourdan 28839b2502 add not-planned and duplicate to issue state to [GithubIssueDetail] (#11666)
* add not-planned and duplicate to issue state to [GithubIssueDetail]

Fixes GitHub issues/PRs - Support the "not planned" state
Fixes #11662

* fix: replace underscore with space in state reason response transformation

* fix: tests after not_planed replaced by not planned

* fix: update issue state color key from not_planned to not planned

* improve testing, forever closed

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

* remove redundent condition

---------

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>
2026-02-08 19:12:18 +00:00

43 lines
1010 B
JavaScript

import { colorScale } from '../color-formatters.js'
import { InvalidResponse, NotFound } from '../index.js'
const documentation = `
You can help increase Shields.io's rate limit by
[authorizing the Shields.io GitHub application](https://img.shields.io/github-auth).
Read more about [how it works](/blog/token-pool).
`
function issueStateColor(s) {
return {
open: '2cbe4e',
closed: '6f42c1',
'not planned': '666c76',
duplicate: '666c76',
}[s]
}
function httpErrorsFor(notFoundMessage = 'repo not found') {
return {
404: notFoundMessage,
422: notFoundMessage,
}
}
function transformErrors(errors, entity = 'repo') {
if (errors[0].type === 'NOT_FOUND') {
return new NotFound({ prettyMessage: `${entity} not found` })
} else {
return new InvalidResponse({ prettyMessage: errors[0].message })
}
}
const commentsColor = colorScale([1, 3, 10, 25], undefined, true)
export {
documentation,
issueStateColor,
commentsColor,
httpErrorsFor,
transformErrors,
}