wtf
This commit is contained in:
parent
08c6b3a2e3
commit
543d33a363
12
.github/workflows/publish-release.yml
vendored
12
.github/workflows/publish-release.yml
vendored
|
@ -8,22 +8,24 @@ jobs:
|
||||||
- name: Validate the release
|
- name: Validate the release
|
||||||
uses: actions/github-script@v4
|
uses: actions/github-script@v4
|
||||||
with:
|
with:
|
||||||
|
github-token: ${{secrets.GITHUB_TOKEN}} # needed to see draft releases
|
||||||
script: |
|
script: |
|
||||||
const ver = "${{ github.ref }}".substring(19)
|
const ver = "${{ github.ref }}".substring(19)
|
||||||
const tag = "v" + ver
|
const tag = "v" + ver
|
||||||
|
var rel
|
||||||
try {
|
try {
|
||||||
const rel = await github.repos.getReleaseByTag({
|
rel = await github.repos.getReleaseByTag({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
tag: tag
|
tag: tag
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(`Could not find a release for tag '${tag}'.`)
|
core.setFailed(`Could not find a release for tag ${tag}.`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (rel.draft) {
|
if (!rel.draft) {
|
||||||
core.setFailed(`Release for tag '${tag}' is already published.`)
|
core.setFailed(`Release for tag ${tag} is already published.`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -32,7 +34,7 @@ jobs:
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
ref: 'tags/' + tag
|
ref: 'tags/' + tag
|
||||||
})
|
})
|
||||||
core.setFailed(`Tag '${tag}' already exists.`)
|
core.setFailed(`Tag ${tag} already exists.`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user