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 version = context.payload.inputs.version
const tag = "v" + version const tag = "v" + version
console.log(`Validate version '${version}'.`) console.log(`Validate version '${version}'.`)
const release = restapi.repos.getReleaseByTag({ try {
owner: context.repo.owner, const release = restapi.repos.getReleaseByTag({
repo: context.repo.repo, owner: context.repo.owner,
tag: tag repo: context.repo.repo,
}) tag: tag
if (release === null) { })
core.setFailed(`Could not find a GitHub release for tag '${tag}'.`) if (release === null) {
return 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) { catch (error)
core.setFailed(`GitHub release for tag '${tag}' is already published.`) {
core.setFailed(`Could not find a GitHub release for tag '${tag}'.`)
return return
} }
try { try {