Skip to content

Commit

Permalink
Warn when target_commit is ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
Spikatrix committed Jun 4, 2023
1 parent 545e4c4 commit ac43879
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as path from 'path'
import * as glob from 'glob'
import {retry} from '@lifeomic/attempt'

const getTag = 'GET /repos/{owner}/{repo}/git/tags/{tag_sha}' as const
const releaseByTag = 'GET /repos/{owner}/{repo}/releases/tags/{tag}' as const
const createRelease = 'POST /repos/{owner}/{repo}/releases' as const
const updateRelease =
Expand Down Expand Up @@ -49,6 +50,15 @@ async function get_release_by_tag(
core.debug(
`Release for tag ${tag} doesn't exist yet so we'll create it now.`
)
if (target_commit) {
try {
await octokit.request(getTag, {
...repo(),
tag_sha: tag
});
core.warning(`Ignoring target_commit as the tag ${tag} already exists`)
} catch { }
}
return await octokit.request(createRelease, {
...repo(),
tag_name: tag,
Expand Down

0 comments on commit ac43879

Please sign in to comment.