Does GHES 3.18 support closing an issue as duplicate per API? (either REST or GraphGL) #177636
-
| Select Topic AreaQuestion BodyTitle basically says it all, with the "Evolution of issues" I want to migrate old issues to the new format, therefor I am looking how to migrate per API my old duplicate labels to the new feature, so Does GHES 3.18 support closing an issue as duplicate per API? (either REST or GraphQL) Looking for this exact feature:  https://github.com/Rand-Random/FbExternalEmbedded/issues/4 | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
| GHES 3.18 supports closing issues as duplicates through the REST API, with the "marked_as_duplicate" event type. GraphQL does not provide a mutation for this action sadly. But already existing duplicate label issues can be migrated by scripting REST API calls to mark and close them as duplicates. | 
Beta Was this translation helpful? Give feedback.
-
| No — GHES 3.18 does not support closing an issue as a duplicate via REST or GraphQL API. The “Close as duplicate” feature shown in the UI (with the “Closed as duplicate of #...”) was introduced in GitHub.com’s Issues 2.0 (the new issue forms and issue states system). That functionality was not exposed via API in GHES 3.18 — neither REST nor GraphQL supported setting the “duplicate” reason when closing an issue. The only programmatic option available in GHES 3.18 is to update the issue state (e.g., closed) and add a comment or label indicating duplication manually, using: REST: PATCH /repos/{owner}/{repo}/issues/{issue_number} with "state": "closed" Then optionally add a comment linking to the original issue. 
 Adding a comment: “Closed as duplicate of #X” Closing the issue via API (state: closed). One-Shot Bash Command that will both comment and close an issue as a duplicate in GHES 3.18 using the REST API : OWNER="your-org-or-user" curl -s -H "Accept: application/vnd.github+json"  | 
Beta Was this translation helpful? Give feedback.

No — GHES 3.18 does not support closing an issue as a duplicate via REST or GraphQL API.
The “Close as duplicate” feature shown in the UI (with the “Closed as duplicate of #...”) was introduced in GitHub.com’s Issues 2.0 (the new issue forms and issue states system).
That functionality was not exposed via API in GHES 3.18 — neither REST nor GraphQL supported setting the “duplicate” reason when closing an issue.
The only programmatic option available in GHES 3.18 is to update the issue state (e.g., closed) and add a comment or label indicating duplication manually, using:
REST: PATCH /repos/{owner}/{repo}/issues/{issue_number} with "state": "closed"
Then optionally add a comment linking to…