* Close the notes issue when an entry is published
(collectionName: string, slug: string)
| 1808 | * Close the notes issue when an entry is published |
| 1809 | */ |
| 1810 | async closeIssueOnPublish(collectionName: string, slug: string): Promise<void> { |
| 1811 | try { |
| 1812 | const issue = await this.findNotesIssue(collectionName, slug, 'open'); |
| 1813 | if (issue) { |
| 1814 | await this.request(`${this.repoURL}/issues/${issue.number}`, { |
| 1815 | method: 'PATCH', |
| 1816 | body: JSON.stringify({ |
| 1817 | state: 'closed', |
| 1818 | labels: [ |
| 1819 | ...(issue.labels || []).map((l: { name: string }) => l.name), |
| 1820 | 'entry-published', |
| 1821 | ], |
| 1822 | }), |
| 1823 | }); |
| 1824 | } |
| 1825 | } catch (error) { |
| 1826 | console.warn('Failed to close notes issue on publish:', error); |
| 1827 | } |
| 1828 | } |
| 1829 | |
| 1830 | /** |
| 1831 | * Reopen the notes issue when an entry is unpublished |
no test coverage detected