This commit is contained in:
Stephan 2022-03-18 16:35:35 +01:00
parent b893475bf9
commit 74f650bb33

View File

@ -16,17 +16,24 @@ module.exports = /*async*/ ({github, context, core}) => {
const version = context.payload.inputs.version
const tag = "v" + version
console.log(`Validate version '${version}'.`)
const release = restapi.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
})
if (release === null) {
core.setFailed(`Could not find a GitHub release for tag '${tag}'.`)
return
try {
const release = restapi.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
})
if (release === null) {
core.setFailed(`Could not find a GitHub release for tag '${tag}'.`)
return
}
if (release.draft) {
core.setFailed(`GitHub release for tag '${tag}' is already published.`)
return
}
}
if (release.draft) {
core.setFailed(`GitHub release for tag '${tag}' is already published.`)
catch (error)
{
core.setFailed(`Could not find a GitHub release for tag '${tag}'.`)
return
}
try {