* List the repo's notes issues by label, not `/search/issues`, which with an * App installation token intermittently answers 422 and so lost notes. With * `collectionName`, also narrowed by the `collection:` label.
(
state: 'open' | 'all',
collectionName?: string,
)
| 1607 | * `collectionName`, also narrowed by the `collection:` label. |
| 1608 | */ |
| 1609 | private async listNotesIssues( |
| 1610 | state: 'open' | 'all', |
| 1611 | collectionName?: string, |
| 1612 | ): Promise<GitHubIssue[]> { |
| 1613 | const labels = collectionName |
| 1614 | ? `${API.NOTES_LABEL},collection:${collectionName}` |
| 1615 | : API.NOTES_LABEL; |
| 1616 | // Paged by number: requestAllPages follows the Link header, which the Turbo |
| 1617 | // proxy does not forward. Capped so a lookup cannot run indefinitely. |
| 1618 | const perPage = 100; |
| 1619 | const maxPages = 20; |
| 1620 | const issues: (GitHubIssue & { pull_request?: unknown })[] = []; |
| 1621 | for (let page = 1; page <= maxPages; page++) { |
| 1622 | const batch: (GitHubIssue & { pull_request?: unknown })[] = await this.request( |
| 1623 | `${this.repoURL}/issues`, |
| 1624 | { params: { labels, state, per_page: perPage, page } }, |
| 1625 | ); |
| 1626 | issues.push(...batch); |
| 1627 | if (batch.length < perPage) break; |
| 1628 | } |
| 1629 | return issues.filter(issue => !issue.pull_request); |
| 1630 | } |
| 1631 | |
| 1632 | private async findNotesIssue( |
| 1633 | collectionName: string, |
no test coverage detected