From ef836e79dbb35894c67ec2fc0844a450e5190dfd Mon Sep 17 00:00:00 2001 From: Ryan Waskiewicz Date: Fri, 4 Apr 2025 16:13:01 -0400 Subject: [PATCH] fix(release): break when draft release is found when a release with the desired tag_name is found, break out of the loop that looks for it. this prevents the case where accidentally overwrite a detected release on successive iterations of the for loop fixes: #602 --- src/github.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/github.ts b/src/github.ts index a43e504..7f8015b 100644 --- a/src/github.ts +++ b/src/github.ts @@ -225,7 +225,7 @@ export const release = async ( const discussion_category_name = config.input_discussion_category_name; const generate_release_notes = config.input_generate_release_notes; try { - // you can't get a an existing draft by tag + // you can't get an existing draft by tag // so we must find one in the list of all releases let _release: Release | undefined = undefined; if (config.input_draft) { @@ -234,6 +234,10 @@ export const release = async ( repo, })) { _release = response.data.find((release) => release.tag_name === tag); + // detect if we found a release - note that a draft release tag may be an empty string + if (typeof _release !== "undefined") { + break; + } } } else { _release = (