Repository: hub4j/github-api (java)

Issue:
Missing support for `generate_release_notes` in Releases API
## Feature request
Recent GitHub API supports `generate_release_notes` body parameter (see the [doc](https://docs.github.com/en/free-pro-team@latest/rest/releases/releases?apiVersion=2022-11-28#create-a-release)) which would allow to generate release name / body automatically. Is is currently not supported by `GHReleaseBuilder`, unfortunately


Pull request description:
Adds support for `generate_release_notes` Release API parameter.
# Description

Added support for `generate_release_notes` request body parameter for [Releases GitHub API](https://docs.github.com/en/free-pro-team@latest/rest/releases/releases?apiVersion=2022-11-28#create-a-release).

This fixes #1745.

# Before submitting a PR:

- [x] Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, [CONTRIBUTING.md](CONTRIBUTING.md) for details.
- [x] Add JavaDocs and other comments explaining the behavior. 
- [ ] When adding or updating methods that fetch entities, add `@link` JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest . 
- [x] Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
- [x] Run `mvn -D enable-ci clean install site` locally. If this command doesn't succeed, your change will not pass CI.
- [x] Push your changes to a branch other than `main`. You will create your PR from that branch.

# When creating a PR: 

- [x] Fill in the "Description" above with clear summary of the changes. This includes:
  - [x] If this PR fixes one or more issues, include "Fixes #<issue number>" lines for each issue. 
  - [x] Provide links to relevant documentation on https://docs.github.com/en/rest where possible. If not including links, explain why not.
- [x] All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario."
- [x] Enable "Allow edits from maintainers".


Patch:
diff --git a/src/main/java/org/kohsuke/github/GHReleaseBuilder.java b/src/main/java/org/kohsuke/github/GHReleaseBuilder.java
index 1490849cc..9b2b4a4f0 100644
--- a/src/main/java/org/kohsuke/github/GHReleaseBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHReleaseBuilder.java
@@ -104,6 +104,19 @@ public class GHReleaseBuilder {
         return this;
     }
 
+    /**
+     * Optional.
+     *
+     * @param generateReleaseNotes
+     *            {@code true} to instruct GitHub to generate release name and notes automatically. {@code false} to
+     *            suppress automatic generation. Default is {@code false}.
+     * @return the gh release builder
+     */
+    public GHReleaseBuilder generateReleaseNotes(boolean generateReleaseNotes) {
+        builder.with("generate_release_notes", generateReleaseNotes);
+        return this;
+    }
+
     /**
      * Values for whether this release should be the latest.
      */


Test patch:
diff --git a/src/test/java/org/kohsuke/github/GHReleaseTest.java b/src/test/java/org/kohsuke/github/GHReleaseTest.java
index 548c83930..65fb6a9ba 100644
--- a/src/test/java/org/kohsuke/github/GHReleaseTest.java
+++ b/src/test/java/org/kohsuke/github/GHReleaseTest.java
@@ -198,4 +198,29 @@ public class GHReleaseTest extends AbstractGitHubWireMockTest {
             }
         }
     }
+
+    /**
+     * Tests creation of the release with `generate_release_notes` parameter on.
+     *
+     * @throws Exception
+     *             if any failure has happened.
+     */
+    @Test
+    public void testCreateReleaseWithNotes() throws Exception {
+        GHRepository repo = gitHub.getRepository("hub4j-test-org/testCreateRelease");
+
+        String tagName = mockGitHub.getMethodName();
+        GHRelease release = new GHReleaseBuilder(repo, tagName).generateReleaseNotes(true).create();
+        try {
+            GHRelease releaseCheck = repo.getRelease(release.getId());
+
+            assertThat(releaseCheck, notNullValue());
+            assertThat(releaseCheck.getTagName(), is(tagName));
+            assertThat(releaseCheck.isPrerelease(), is(false));
+            assertThat(releaseCheck.getDiscussionUrl(), notNullValue());
+        } finally {
+            release.delete();
+            assertThat(repo.getRelease(release.getId()), nullValue());
+        }
+    }
 }
diff --git a/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/1-r_h_testcreaterelease.json b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/1-r_h_testcreaterelease.json
new file mode 100644
index 000000000..81c365ef0
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/1-r_h_testcreaterelease.json
@@ -0,0 +1,132 @@
+{
+  "id": 375534019,
+  "node_id": "MDEwOlJlcG9zaXRvcnkzNzU1MzQwMTk=",
+  "name": "testCreateRelease",
+  "full_name": "hub4j-test-org/testCreateRelease",
+  "private": false,
+  "owner": {
+    "login": "hub4j-test-org",
+    "id": 7544739,
+    "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+    "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/hub4j-test-org",
+    "html_url": "https://github.com/hub4j-test-org",
+    "followers_url": "https://api.github.com/users/hub4j-test-org/followers",
+    "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
+    "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
+    "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
+    "repos_url": "https://api.github.com/users/hub4j-test-org/repos",
+    "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
+    "type": "Organization",
+    "site_admin": false
+  },
+  "html_url": "https://github.com/hub4j-test-org/testCreateRelease",
+  "description": null,
+  "fork": false,
+  "url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease",
+  "forks_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/forks",
+  "keys_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/keys{/key_id}",
+  "collaborators_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/collaborators{/collaborator}",
+  "teams_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/teams",
+  "hooks_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/hooks",
+  "issue_events_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/issues/events{/number}",
+  "events_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/events",
+  "assignees_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/assignees{/user}",
+  "branches_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/branches{/branch}",
+  "tags_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/tags",
+  "blobs_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/git/blobs{/sha}",
+  "git_tags_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/git/tags{/sha}",
+  "git_refs_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/git/refs{/sha}",
+  "trees_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/git/trees{/sha}",
+  "statuses_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/statuses/{sha}",
+  "languages_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/languages",
+  "stargazers_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/stargazers",
+  "contributors_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/contributors",
+  "subscribers_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/subscribers",
+  "subscription_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/subscription",
+  "commits_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/commits{/sha}",
+  "git_commits_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/git/commits{/sha}",
+  "comments_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/comments{/number}",
+  "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/issues/comments{/number}",
+  "contents_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/contents/{+path}",
+  "compare_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/compare/{base}...{head}",
+  "merges_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/merges",
+  "archive_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/{archive_format}{/ref}",
+  "downloads_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/downloads",
+  "issues_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/issues{/number}",
+  "pulls_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/pulls{/number}",
+  "milestones_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/milestones{/number}",
+  "notifications_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/notifications{?since,all,participating}",
+  "labels_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/labels{/name}",
+  "releases_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/releases{/id}",
+  "deployments_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/deployments",
+  "created_at": "2021-06-10T01:25:59Z",
+  "updated_at": "2021-06-10T01:31:14Z",
+  "pushed_at": "2021-06-10T16:14:27Z",
+  "git_url": "git://github.com/hub4j-test-org/testCreateRelease.git",
+  "ssh_url": "git@github.com:hub4j-test-org/testCreateRelease.git",
+  "clone_url": "https://github.com/hub4j-test-org/testCreateRelease.git",
+  "svn_url": "https://github.com/hub4j-test-org/testCreateRelease",
+  "homepage": null,
+  "size": 11948,
+  "stargazers_count": 0,
+  "watchers_count": 0,
+  "language": "Java",
+  "has_issues": false,
+  "has_projects": false,
+  "has_downloads": true,
+  "has_wiki": false,
+  "has_pages": false,
+  "forks_count": 0,
+  "mirror_url": null,
+  "archived": false,
+  "disabled": false,
+  "open_issues_count": 0,
+  "license": {
+    "key": "mit",
+    "name": "MIT License",
+    "spdx_id": "MIT",
+    "url": "https://api.github.com/licenses/mit",
+    "node_id": "MDc6TGljZW5zZTEz"
+  },
+  "forks": 0,
+  "open_issues": 0,
+  "watchers": 0,
+  "default_branch": "main",
+  "permissions": {
+    "admin": true,
+    "push": true,
+    "pull": true
+  },
+  "temp_clone_token": "",
+  "allow_squash_merge": true,
+  "allow_merge_commit": true,
+  "allow_rebase_merge": true,
+  "delete_branch_on_merge": false,
+  "organization": {
+    "login": "hub4j-test-org",
+    "id": 7544739,
+    "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+    "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/hub4j-test-org",
+    "html_url": "https://github.com/hub4j-test-org",
+    "followers_url": "https://api.github.com/users/hub4j-test-org/followers",
+    "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
+    "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
+    "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
+    "repos_url": "https://api.github.com/users/hub4j-test-org/repos",
+    "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
+    "type": "Organization",
+    "site_admin": false
+  },
+  "network_count": 0,
+  "subscribers_count": 11
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/2-r_h_t_releases.json b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/2-r_h_t_releases.json
new file mode 100644
index 000000000..7883902aa
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/2-r_h_t_releases.json
@@ -0,0 +1,40 @@
+{
+  "url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/releases/44460162",
+  "assets_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/releases/44460162/assets",
+  "upload_url": "https://uploads.github.com/repos/hub4j-test-org/testCreateRelease/releases/44460162/assets{?name,label}",
+  "html_url": "https://github.com/hub4j-test-org/testCreateRelease/releases/tag/testCreateSimpleRelease",
+  "id": 44460162,
+  "author": {
+    "login": "jlengrand",
+    "id": 921666,
+    "node_id": "MDQ6VXNlcjkyMTY2Ng==",
+    "avatar_url": "https://avatars.githubusercontent.com/u/921666?v=4",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/jlengrand",
+    "html_url": "https://github.com/jlengrand",
+    "followers_url": "https://api.github.com/users/jlengrand/followers",
+    "following_url": "https://api.github.com/users/jlengrand/following{/other_user}",
+    "gists_url": "https://api.github.com/users/jlengrand/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/jlengrand/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/jlengrand/subscriptions",
+    "organizations_url": "https://api.github.com/users/jlengrand/orgs",
+    "repos_url": "https://api.github.com/users/jlengrand/repos",
+    "events_url": "https://api.github.com/users/jlengrand/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/jlengrand/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "node_id": "MDc6UmVsZWFzZTQ0NDYwMTYy",
+  "tag_name": "testCreateSimpleRelease",
+  "target_commitish": "main",
+  "name": null,
+  "draft": false,
+  "prerelease": false,
+  "created_at": "2021-06-02T21:59:14Z",
+  "published_at": "2021-06-11T06:56:52Z",
+  "assets": [],
+  "tarball_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/tarball/testCreateSimpleRelease",
+  "zipball_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/zipball/testCreateSimpleRelease",
+  "body": null,
+  "discussion_url": "https://github.com/hub4j-test-org/testCreateRelease/discussions/6"
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/3-r_h_t_releases_44460162.json b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/3-r_h_t_releases_44460162.json
new file mode 100644
index 000000000..79e3e0aa2
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/__files/3-r_h_t_releases_44460162.json
@@ -0,0 +1,40 @@
+{
+  "url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/releases/44460162",
+  "assets_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/releases/44460162/assets",
+  "upload_url": "https://uploads.github.com/repos/hub4j-test-org/testCreateRelease/releases/44460162/assets{?name,label}",
+  "html_url": "https://github.com/hub4j-test-org/testCreateRelease/releases/tag/testCreateSimpleRelease",
+  "id": 44460162,
+  "author": {
+    "login": "jlengrand",
+    "id": 921666,
+    "node_id": "MDQ6VXNlcjkyMTY2Ng==",
+    "avatar_url": "https://avatars.githubusercontent.com/u/921666?v=4",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/jlengrand",
+    "html_url": "https://github.com/jlengrand",
+    "followers_url": "https://api.github.com/users/jlengrand/followers",
+    "following_url": "https://api.github.com/users/jlengrand/following{/other_user}",
+    "gists_url": "https://api.github.com/users/jlengrand/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/jlengrand/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/jlengrand/subscriptions",
+    "organizations_url": "https://api.github.com/users/jlengrand/orgs",
+    "repos_url": "https://api.github.com/users/jlengrand/repos",
+    "events_url": "https://api.github.com/users/jlengrand/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/jlengrand/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "node_id": "MDc6UmVsZWFzZTQ0NDYwMTYy",
+  "tag_name": "testCreateReleaseWithNotes",
+  "target_commitish": "main",
+  "name": null,
+  "draft": false,
+  "prerelease": false,
+  "created_at": "2021-06-02T21:59:14Z",
+  "published_at": "2021-06-11T06:56:52Z",
+  "assets": [],
+  "tarball_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/tarball/testCreateSimpleRelease",
+  "zipball_url": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/zipball/testCreateSimpleRelease",
+  "body": null,
+  "discussion_url": "https://github.com/hub4j-test-org/testCreateRelease/discussions/6"
+}
diff --git a/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/1-r_h_testcreaterelease.json b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/1-r_h_testcreaterelease.json
new file mode 100644
index 000000000..452493cae
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/1-r_h_testcreaterelease.json
@@ -0,0 +1,47 @@
+{
+  "id": "9662df75-a233-4594-b75e-062a2f61f0b4",
+  "name": "repos_hub4j-test-org_testcreaterelease",
+  "request": {
+    "url": "/repos/hub4j-test-org/testCreateRelease",
+    "method": "GET",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github.v3+json"
+      }
+    }
+  },
+  "response": {
+    "status": 200,
+    "bodyFileName": "1-r_h_testcreaterelease.json",
+    "headers": {
+      "Server": "GitHub.com",
+      "Date": "Fri, 11 Jun 2021 06:56:51 GMT",
+      "Content-Type": "application/json; charset=utf-8",
+      "Cache-Control": "private, max-age=60, s-maxage=60",
+      "Vary": [
+        "Accept, Authorization, Cookie, X-GitHub-OTP",
+        "Accept-Encoding, Accept, X-Requested-With"
+      ],
+      "ETag": "W/\"ef9d3ab50cfe0ffaaf23afcd5bf34b497f69be8ea9cdf2e52817c11ebc845494\"",
+      "Last-Modified": "Thu, 10 Jun 2021 01:31:14 GMT",
+      "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
+      "X-Accepted-OAuth-Scopes": "repo",
+      "X-GitHub-Media-Type": "unknown, github.v3",
+      "X-RateLimit-Limit": "5000",
+      "X-RateLimit-Remaining": "4999",
+      "X-RateLimit-Reset": "1623398211",
+      "X-RateLimit-Used": "1",
+      "X-RateLimit-Resource": "core",
+      "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+      "X-Frame-Options": "deny",
+      "X-Content-Type-Options": "nosniff",
+      "X-XSS-Protection": "0",
+      "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+      "Content-Security-Policy": "default-src 'none'",
+      "X-GitHub-Request-Id": "E62F:E96C:32AE84C:33F7832:60C30933"
+    }
+  },
+  "uuid": "9662df75-a233-4594-b75e-062a2f61f0b4",
+  "persistent": true,
+  "insertionIndex": 1
+}
diff --git a/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/2-r_h_t_releases.json b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/2-r_h_t_releases.json
new file mode 100644
index 000000000..28868d629
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/2-r_h_t_releases.json
@@ -0,0 +1,52 @@
+{
+  "id": "2e081774-790c-4d7b-9f4b-71bad948a411",
+  "name": "repos_hub4j-test-org_testcreaterelease_releases",
+  "request": {
+    "url": "/repos/hub4j-test-org/testCreateRelease/releases",
+    "method": "POST",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github.v3+json"
+      }
+    },
+    "bodyPatterns" : [
+      {
+        "matchesJsonPath" : "$.[?(@.generate_release_notes == true)]"
+      }
+    ]
+  },
+  "response": {
+    "status": 201,
+    "bodyFileName": "2-r_h_t_releases.json",
+    "headers": {
+      "Server": "GitHub.com",
+      "Date": "Fri, 11 Jun 2021 06:56:52 GMT",
+      "Content-Type": "application/json; charset=utf-8",
+      "Cache-Control": "private, max-age=60, s-maxage=60",
+      "Vary": [
+        "Accept, Authorization, Cookie, X-GitHub-OTP",
+        "Accept-Encoding, Accept, X-Requested-With"
+      ],
+      "ETag": "\"c0ff7f2f2ceb987472055c911610b16469c63e1928f209d5f58045a6e1cf861c\"",
+      "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
+      "X-Accepted-OAuth-Scopes": "repo",
+      "X-GitHub-Media-Type": "unknown, github.v3",
+      "X-RateLimit-Limit": "5000",
+      "X-RateLimit-Remaining": "4998",
+      "X-RateLimit-Reset": "1623398211",
+      "X-RateLimit-Used": "2",
+      "X-RateLimit-Resource": "core",
+      "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+      "X-Frame-Options": "deny",
+      "X-Content-Type-Options": "nosniff",
+      "X-XSS-Protection": "0",
+      "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+      "Content-Security-Policy": "default-src 'none'",
+      "X-GitHub-Request-Id": "E630:CE80:ED7A93:F2C7E4:60C30933",
+      "Location": "https://api.github.com/repos/hub4j-test-org/testCreateRelease/releases/44460162"
+    }
+  },
+  "uuid": "2e081774-790c-4d7b-9f4b-71bad948a411",
+  "persistent": true,
+  "insertionIndex": 2
+}
diff --git a/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/3-r_h_t_releases_44460162.json b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/3-r_h_t_releases_44460162.json
new file mode 100644
index 000000000..d9c9e307f
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/3-r_h_t_releases_44460162.json
@@ -0,0 +1,50 @@
+{
+  "id": "16bc45b2-4a87-46f2-977d-d0cbe7bf10ba",
+  "name": "repos_hub4j-test-org_testcreaterelease_releases_44460162",
+  "request": {
+    "url": "/repos/hub4j-test-org/testCreateRelease/releases/44460162",
+    "method": "GET",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github.v3+json"
+      }
+    }
+  },
+  "response": {
+    "status": 200,
+    "bodyFileName": "3-r_h_t_releases_44460162.json",
+    "headers": {
+      "Server": "GitHub.com",
+      "Date": "Fri, 11 Jun 2021 06:56:52 GMT",
+      "Content-Type": "application/json; charset=utf-8",
+      "Cache-Control": "private, max-age=60, s-maxage=60",
+      "Vary": [
+        "Accept, Authorization, Cookie, X-GitHub-OTP",
+        "Accept-Encoding, Accept, X-Requested-With"
+      ],
+      "ETag": "W/\"c0ff7f2f2ceb987472055c911610b16469c63e1928f209d5f58045a6e1cf861c\"",
+      "Last-Modified": "Fri, 11 Jun 2021 06:56:52 GMT",
+      "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
+      "X-Accepted-OAuth-Scopes": "repo",
+      "X-GitHub-Media-Type": "unknown, github.v3",
+      "X-RateLimit-Limit": "5000",
+      "X-RateLimit-Remaining": "4997",
+      "X-RateLimit-Reset": "1623398211",
+      "X-RateLimit-Used": "3",
+      "X-RateLimit-Resource": "core",
+      "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+      "X-Frame-Options": "deny",
+      "X-Content-Type-Options": "nosniff",
+      "X-XSS-Protection": "0",
+      "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+      "Content-Security-Policy": "default-src 'none'",
+      "X-GitHub-Request-Id": "E631:E96A:C62EC6:D5D381:60C30934"
+    }
+  },
+  "uuid": "16bc45b2-4a87-46f2-977d-d0cbe7bf10ba",
+  "persistent": true,
+  "scenarioName": "scenario-1-repos-hub4j-test-org-testCreateRelease-releases-44460162",
+  "requiredScenarioState": "Started",
+  "newScenarioState": "scenario-1-repos-hub4j-test-org-testCreateRelease-releases-44460162-2",
+  "insertionIndex": 3
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/4-r_h_t_releases_44460162.json b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/4-r_h_t_releases_44460162.json
new file mode 100644
index 000000000..820be9c09
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/4-r_h_t_releases_44460162.json
@@ -0,0 +1,39 @@
+{
+  "id": "083fedc2-a431-4eb7-bfde-5015864d6a4b",
+  "name": "repos_hub4j-test-org_testcreaterelease_releases_44460162",
+  "request": {
+    "url": "/repos/hub4j-test-org/testCreateRelease/releases/44460162",
+    "method": "DELETE",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github.v3+json"
+      }
+    }
+  },
+  "response": {
+    "status": 204,
+    "headers": {
+      "Server": "GitHub.com",
+      "Date": "Fri, 11 Jun 2021 06:56:53 GMT",
+      "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
+      "X-Accepted-OAuth-Scopes": "repo",
+      "X-GitHub-Media-Type": "unknown, github.v3",
+      "X-RateLimit-Limit": "5000",
+      "X-RateLimit-Remaining": "4996",
+      "X-RateLimit-Reset": "1623398211",
+      "X-RateLimit-Used": "4",
+      "X-RateLimit-Resource": "core",
+      "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+      "X-Frame-Options": "deny",
+      "X-Content-Type-Options": "nosniff",
+      "X-XSS-Protection": "0",
+      "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+      "Content-Security-Policy": "default-src 'none'",
+      "Vary": "Accept-Encoding, Accept, X-Requested-With",
+      "X-GitHub-Request-Id": "E632:E6B9:F3DDE8:F93B50:60C30934"
+    }
+  },
+  "uuid": "083fedc2-a431-4eb7-bfde-5015864d6a4b",
+  "persistent": true,
+  "insertionIndex": 4
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/5-r_h_t_releases_44460162.json b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/5-r_h_t_releases_44460162.json
new file mode 100644
index 000000000..6f2374c2b
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHReleaseTest/wiremock/testCreateReleaseWithNotes/mappings/5-r_h_t_releases_44460162.json
@@ -0,0 +1,43 @@
+{
+  "id": "c421435f-0901-45f3-9ca4-6d9a3d46bf6c",
+  "name": "repos_hub4j-test-org_testcreaterelease_releases_44460162",
+  "request": {
+    "url": "/repos/hub4j-test-org/testCreateRelease/releases/44460162",
+    "method": "GET",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github.v3+json"
+      }
+    }
+  },
+  "response": {
+    "status": 404,
+    "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/reference/repos#get-a-release\"}",
+    "headers": {
+      "Server": "GitHub.com",
+      "Date": "Fri, 11 Jun 2021 06:56:53 GMT",
+      "Content-Type": "application/json; charset=utf-8",
+      "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
+      "X-Accepted-OAuth-Scopes": "repo",
+      "X-GitHub-Media-Type": "unknown, github.v3",
+      "X-RateLimit-Limit": "5000",
+      "X-RateLimit-Remaining": "4995",
+      "X-RateLimit-Reset": "1623398211",
+      "X-RateLimit-Used": "5",
+      "X-RateLimit-Resource": "core",
+      "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+      "X-Frame-Options": "deny",
+      "X-Content-Type-Options": "nosniff",
+      "X-XSS-Protection": "0",
+      "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+      "Content-Security-Policy": "default-src 'none'",
+      "Vary": "Accept-Encoding, Accept, X-Requested-With",
+      "X-GitHub-Request-Id": "E633:E150:F261A6:F7C867:60C30935"
+    }
+  },
+  "uuid": "c421435f-0901-45f3-9ca4-6d9a3d46bf6c",
+  "persistent": true,
+  "scenarioName": "scenario-1-repos-hub4j-test-org-testCreateRelease-releases-44460162",
+  "requiredScenarioState": "scenario-1-repos-hub4j-test-org-testCreateRelease-releases-44460162-2",
+  "insertionIndex": 5
+}
\ No newline at end of file