mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-10 02:44:19 +00:00
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
This commit is contained in:
parent
c95fe14893
commit
ef836e79db
1 changed files with 5 additions and 1 deletions
|
@ -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 = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue