From 1ff25f9d33be5bfd73612bd88dd4f5a134c39d31 Mon Sep 17 00:00:00 2001 From: Yidi Date: Thu, 26 Sep 2024 21:20:07 -0400 Subject: [PATCH] fix(workflow): improve release existence check in release-on-tag.yml Refactor the script to improve checking for existing releases by tag. Return an object instead of using core.setOutput to streamline the workflow logic. Also, set result-encoding to string for better compatibility. --- .github/workflows/release-on-tag.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index f9399316..5a65a969 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -15,19 +15,20 @@ jobs: with: script: | try { - const release = await github.rest.repos.getReleaseByTag({ + await github.rest.repos.getReleaseByTag({ owner: context.repo.owner, repo: context.repo.repo, tag: context.ref.replace('refs/tags/', ''), }) - core.setOutput('release_exists', 'true') + return { release_exists: 'true' } } catch (error) { if (error.status === 404) { - core.setOutput('release_exists', 'false') + return { release_exists: 'false' } } else { throw error } } + result-encoding: string - name: Create Release if: steps.check_release.outputs.release_exists == 'false'