Skip to content

Commit

Permalink
Merge pull request #3 from thought-machine/fix-release-check
Browse files Browse the repository at this point in the history
Fix check for existing release
  • Loading branch information
Tatskaari authored Apr 19, 2022
2 parents e130f9a + 87933a6 commit 1734ce6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8564,11 +8564,16 @@ async function run() {
let uploadUrl = undefined
let releaseId = undefined

let releaseName = `v${version}`
if(releasePrefix !== "") {
releaseName = `${releasePrefix}-${releaseName}`
}

try {
existingReleaseResp = await octokit.rest.repos.getReleaseByTag({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
tag: "v" + version,
tag: releaseName,
})
uploadUrl = existingReleaseResp.data.upload_url
releaseId = existingReleaseResp.data.id
Expand All @@ -8577,10 +8582,6 @@ async function run() {
}

if (uploadUrl === undefined) {
let releaseName = `v${version}`
if(releasePrefix !== "") {
releaseName = `${releasePrefix}-${releaseName}`
}
console.log(`Creating release ${releaseName}...`)

const createReleaseResp = await octokit.rest.repos.createRelease({
Expand Down
11 changes: 6 additions & 5 deletions src/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ async function run() {
let uploadUrl = undefined
let releaseId = undefined

let releaseName = `v${version}`
if(releasePrefix !== "") {
releaseName = `${releasePrefix}-${releaseName}`
}

try {
existingReleaseResp = await octokit.rest.repos.getReleaseByTag({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
tag: "v" + version,
tag: releaseName,
})
uploadUrl = existingReleaseResp.data.upload_url
releaseId = existingReleaseResp.data.id
Expand All @@ -46,10 +51,6 @@ async function run() {
}

if (uploadUrl === undefined) {
let releaseName = `v${version}`
if(releasePrefix !== "") {
releaseName = `${releasePrefix}-${releaseName}`
}
console.log(`Creating release ${releaseName}...`)

const createReleaseResp = await octokit.rest.repos.createRelease({
Expand Down

0 comments on commit 1734ce6

Please sign in to comment.