Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f516337

Browse files
authored
fix(latest): add make_latest property to the GH release PATCH request during publish (#1169)
* fix(latest): add make_latest property to the GH release PATCH request during publish It's required to not mark as latest when removing draft status after assets upload * test: fix tests
1 parent f367e3a commit f516337

File tree

3 files changed

+8
-6
lines changed
  • lib
    • publish.js
  • test
    • integration.test.js
    • publish.test.js

3 files changed

+8
-6
lines changed

lib/publish.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export default async function publish(pluginConfig, context, { Octokit }) {
167167
repo,
168168
release_id: releaseId,
169169
draft: false,
170+
make_latest: isLatestRelease(branch),
170171
};
171172

172173
// add discussion_category_name if discussionCategoryName is not undefined or false

test/integration.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ test("Publish a release with an array of assets", async (t) => {
418418
`https://api.github.local/repos/${owner}/${repo}/releases/${releaseId}`,
419419
{ html_url: releaseUrl },
420420
{
421-
body: { draft: false },
421+
body: { draft: false, make_latest: "true" },
422422
},
423423
)
424424
.postOnce(
@@ -514,7 +514,7 @@ test("Publish a release with release information in assets", async (t) => {
514514
`https://api.github.local/repos/${owner}/${repo}/releases/${releaseId}`,
515515
{ html_url: releaseUrl },
516516
{
517-
body: { draft: false },
517+
body: { draft: false, make_latest: "false" },
518518
},
519519
)
520520
.postOnce(
@@ -910,7 +910,7 @@ test("Verify, release and notify success", async (t) => {
910910
.patchOnce(
911911
`https://api.github.local/repos/${owner}/${repo}/releases/${releaseId}`,
912912
{ html_url: releaseUrl },
913-
{ body: { draft: false } },
913+
{ body: { draft: false, make_latest: "true" } },
914914
)
915915
.getOnce(
916916
`https://api.github.local/repos/${owner}/${repo}/pulls/1/commits`,

test/publish.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ test("Publish a release with one asset", async (t) => {
461461
.patchOnce(
462462
`https://api.github.local/repos/${owner}/${repo}/releases/${releaseId}`,
463463
{ upload_url: uploadUrl, html_url: releaseUrl },
464-
{ body: { draft: false } },
464+
{ body: { draft: false, make_latest: "true" } },
465465
)
466466
.postOnce(
467467
`${uploadOrigin}${uploadUri}?name=${encodeURIComponent(
@@ -549,7 +549,7 @@ test("Publish a release with one asset and custom github url", async (t) => {
549549
.patchOnce(
550550
`${env.GH_URL}/prefix/repos/${owner}/${repo}/releases/${releaseId}`,
551551
{ upload_url: uploadUrl, html_url: releaseUrl },
552-
{ body: { draft: false } },
552+
{ body: { draft: false, make_latest: "true" } },
553553
)
554554
.postOnce(
555555
`${env.GH_URL}${uploadUri}?name=${encodeURIComponent(
@@ -631,7 +631,7 @@ test("Publish a release with an array of missing assets", async (t) => {
631631
.patchOnce(
632632
`https://api.github.local/repos/${owner}/${repo}/releases/${releaseId}`,
633633
{ html_url: releaseUrl },
634-
{ body: { draft: false } },
634+
{ body: { draft: false, make_latest: "true" } },
635635
);
636636

637637
const result = await publish(
@@ -729,6 +729,7 @@ test("Publish a release with asset and create discussion", async (t) => {
729729
body: {
730730
draft: false,
731731
discussion_category_name: pluginConfig.discussionCategoryName,
732+
make_latest: "true",
732733
},
733734
},
734735
)

0 commit comments

Comments
(0)