1
0
This commit is contained in:
Stephan 2022-03-18 18:00:22 +01:00
parent b3615798ac
commit f916de4ff4

View File

@ -19,12 +19,12 @@ module.exports = /*async*/ ({github, context, core}) => {
console.log(`Validate version '${version}'.`) console.log(`Validate version '${version}'.`)
// git branch must exist // git branch must exist
const refs = await restapi.git.listMatchingRefs({ const branchRefs = await restapi.git.listMatchingRefs({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
ref: `heads/release/${version}` ref: `heads/release/${version}`
}) })
if (firstOrDefault(refs, (x) => x.ref == `heads/release/${version}`) == null) { if (firstOrDefault(branchRefs.data, (x) => x.ref == `heads/release/${version}`) == null) {
core.setFailed(`Could not find branch 'release/${version}'.`) core.setFailed(`Could not find branch 'release/${version}'.`)
return return
} }
@ -66,12 +66,12 @@ module.exports = /*async*/ ({github, context, core}) => {
console.log(`Found yet-unpublished GitHub Release for tag '${tag}'.`) console.log(`Found yet-unpublished GitHub Release for tag '${tag}'.`)
// tag must not exist // tag must not exist
const refs = await restapi.git.listMatchingRefs({ const tagRefs = await restapi.git.listMatchingRefs({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
ref: `tags/${tag}` ref: `tags/${tag}`
}) })
if (firstOrDefault(refs.data, (x) => x.ref == `tags/${tag}`) != null) { if (firstOrDefault(tagRefs.data, (x) => x.ref == `tags/${tag}`) != null) {
core.setFailed(`Tag '${tag}' already exists.`) core.setFailed(`Tag '${tag}' already exists.`)
return return
} }