From 1662cfa4493922f158830564d6da8a6ffd57b27b Mon Sep 17 00:00:00 2001 From: regevbr Date: Wed, 31 May 2023 10:52:21 +0300 Subject: [PATCH] fix #197 - do not overwrite, if empty --- dist/index.js | 4 ++-- package-lock.json | 4 ++-- src/main.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index c4fed6a5..08f0c03a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -75,12 +75,12 @@ function get_release_by_tag(tag, prerelease, make_latest, release_name, body, oc updateObject.prerelease = false; } if (overwrite) { - if (release.data.name !== release_name) { + if (release_name && release.data.name !== release_name) { core.debug(`The ${tag} release already exists with a different name ${release.data.name} so we'll overwrite it.`); updateObject = updateObject || {}; updateObject.name = release_name; } - if (release.data.body !== body) { + if (body && release.data.body !== body) { core.debug(`The ${tag} release already exists with a different body ${release.data.body} so we'll overwrite it.`); updateObject = updateObject || {}; updateObject.body = body; diff --git a/package-lock.json b/package-lock.json index 31ddd6d7..584a06ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "upload-release-action", - "version": "2.5.0", + "version": "2.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "upload-release-action", - "version": "2.5.0", + "version": "2.6.0", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", diff --git a/src/main.ts b/src/main.ts index 2330b23e..f0a077a5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -67,14 +67,14 @@ async function get_release_by_tag( updateObject.prerelease = false } if (overwrite) { - if (release.data.name !== release_name) { + if (release_name && release.data.name !== release_name) { core.debug( `The ${tag} release already exists with a different name ${release.data.name} so we'll overwrite it.` ) updateObject = updateObject || {} updateObject.name = release_name } - if (release.data.body !== body) { + if (body && release.data.body !== body) { core.debug( `The ${tag} release already exists with a different body ${release.data.body} so we'll overwrite it.` )