From 7f5ce2d1ab0f0b0c97bca596c502611b28b48eb7 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:01:25 -0500 Subject: [PATCH] fix(patch-releases): skip non existent releases (#316) --- .github/workflows/patch_missing_releases.yml | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/patch_missing_releases.yml b/.github/workflows/patch_missing_releases.yml index 5c4f714c..58033b26 100644 --- a/.github/workflows/patch_missing_releases.yml +++ b/.github/workflows/patch_missing_releases.yml @@ -48,18 +48,22 @@ jobs: // get release for tag console.log(`Getting release for tag: ${tag.name}`) - const release = await github.rest.repos.getReleaseByTag({ - owner: context.repo.owner, - repo: repo.name, - tag: tag.name - }) - - // edit the release (without making any changes) - console.log(`Editing release for tag: ${tag.name}`) - await github.rest.repos.updateRelease({ + try { + const release = await github.rest.repos.getReleaseByTag({ owner: context.repo.owner, repo: repo.name, - release_id: release.data.id, - }) + tag: tag.name + }) + + // edit the release (without making any changes) + console.log(`Editing release for tag: ${tag.name}`) + await github.rest.repos.updateRelease({ + owner: context.repo.owner, + repo: repo.name, + release_id: release.data.id, + }) + } catch (error) { + console.log(`No release found for tag: ${tag.name}`) + } } }