From 48d061afd22fa15ac1760216c6470725b4f4c6c4 Mon Sep 17 00:00:00 2001 From: Andrey Akinshin Date: Tue, 2 Jan 2024 22:51:21 +0100 Subject: [PATCH] [feat] Introduce NewRelease.DiscussionCategoryName, Fixes #2746 Co-authored-by: Nick Floyd <139819+nickfloyd@users.noreply.github.com> --- Octokit/Models/Request/NewRelease.cs | 9 +++++++++ docs/releases.md | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Octokit/Models/Request/NewRelease.cs b/Octokit/Models/Request/NewRelease.cs index 8f412a2c3c..04ee482c59 100644 --- a/Octokit/Models/Request/NewRelease.cs +++ b/Octokit/Models/Request/NewRelease.cs @@ -73,6 +73,15 @@ public NewRelease(string tagName) /// public bool Prerelease { get; set; } + /// + /// If specified, a discussion of the specified category is created and linked to the release. + /// The value must be a category that already exists in the repository. + /// + /// The discussion category name. + /// + /// + public string DiscussionCategoryName { get; set; } + /// /// Gets or sets a value indicating whether to automatically generate the name and body for this release. /// If name is specified, the specified name will be used; otherwise, a name will diff --git a/docs/releases.md b/docs/releases.md index 0f9a893866..7d89808853 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -55,6 +55,18 @@ newRelease.GenerateReleaseNotes = true; // Set for Name and Body to be generated newRelease.TargetCommitish = "main"; // Optional, can be a branch, tag, or SHA; defaults to the main branch. ``` +### Generate a discussion + +Using the `DiscussionCategoryName`, it's possible to create a discussion linked to the upcoming release. +The value must be a category that already exists in the repository. +For more information, see "[Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository)." + +```csharp +var newTag = "v1.5.7"; +var newRelease = new NewRelease(newTag); +newRelease.DiscussionCategoryName = "Announcements"; +``` + #### Customizing generated notes ```csharp var newTag = "v1.5.7";