Skip to content

Commit

Permalink
Use the ref api to check if a tag exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Spikatrix committed Jun 10, 2023
1 parent 212d4ba commit f47fb36
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +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 getRef = 'GET /repos/{owner}/{repo}/git/ref/{ref}' 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 @@ -52,10 +52,10 @@ async function get_release_by_tag(
)
if (target_commit) {
try {
await octokit.request(getTag, {
await octokit.request(getRef, {
...repo(),
tag_sha: tag
});
ref: `tags/${tag}`
})
core.warning(`Ignoring target_commit as the tag ${tag} already exists`)
} catch (tagError: any) {
if (tagError.status !== 404) {
Expand Down

0 comments on commit f47fb36

Please sign in to comment.