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.
This commit is contained in:
parent
bc08931b8d
commit
1ff25f9d33
7
.github/workflows/release-on-tag.yml
vendored
7
.github/workflows/release-on-tag.yml
vendored
@ -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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user