MCPcopy
hub / github.com/iptv-org/iptv / loadIssues

Function loadIssues

scripts/utils.ts:152–178  ·  view source on GitHub ↗
(props?: { labels: string | string[] })

Source from the content-addressed store, hash-verified

150}
151
152export async function loadIssues(props?: { labels: string | string[] }) {
153 const CustomOctokit = Octokit.plugin(paginateRest, restEndpointMethods)
154 const octokit = new CustomOctokit()
155
156 let labels = ''
157 if (props && props.labels) {
158 labels = Array.isArray(props.labels) ? props.labels.join(',') : props.labels
159 }
160 let issues: object[] = []
161 if (TESTING) {
162 issues = (await import('../tests/__data__/input/issues.js')).default
163 } else {
164 issues = await octokit.paginate(octokit.rest.issues.listForRepo, {
165 owner: OWNER,
166 repo: REPO,
167 per_page: 100,
168 labels,
169 status: 'open',
170 direction: 'asc',
171 headers: {
172 'X-GitHub-Api-Version': '2022-11-28'
173 }
174 })
175 }
176
177 return new Collection(issues).map(parseIssue)
178}
179
180function parseIssue(issue: { number: number; body: string; labels: { name: string }[] }): Issue {
181 const FIELDS = new Dictionary({

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected