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

Method reopenIssueOnUnpublish

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

* Reopen the notes issue when an entry is unpublished

(collectionName: string, slug: string)

Source from the content-addressed store, hash-verified

1831 * Reopen the notes issue when an entry is unpublished
1832 */
1833 async reopenIssueOnUnpublish(collectionName: string, slug: string): Promise<void> {
1834 try {
1835 const issue = await this.findNotesIssue(collectionName, slug, 'all');
1836 if (issue) {
1837 // Remove 'entry-published' or 'entry-deleted' labels and reopen
1838 const updatedLabels = (issue.labels || [])
1839 .map((l: { name: string }) => l.name)
1840 .filter((name: string) => name !== 'entry-published' && name !== 'entry-deleted');
1841
1842 await this.request(`${this.repoURL}/issues/${issue.number}`, {
1843 method: 'PATCH',
1844 body: JSON.stringify({
1845 state: 'open',
1846 labels: updatedLabels,
1847 }),
1848 });
1849 }
1850 } catch (error) {
1851 console.warn('Failed to reopen notes issue on unpublish:', error);
1852 }
1853 }
1854
1855 /**
1856 * Get all notes for an entry

Callers 1

Calls 4

findNotesIssueMethod · 0.95
requestMethod · 0.95
filterMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected