MCPcopy Create free account
hub / github.com/decaporg/decap-cms / closeIssueOnPublish

Method closeIssueOnPublish

packages/decap-cms-backend-github/src/API.ts:1810–1828  ·  view source on GitHub ↗

* Close the notes issue when an entry is published

(collectionName: string, slug: string)

Source from the content-addressed store, hash-verified

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

Callers 3

API.spec.jsFile · 0.45

Calls 3

findNotesIssueMethod · 0.95
requestMethod · 0.95
mapMethod · 0.80

Tested by

no test coverage detected