From f47fb36ff144f9eab8d910447533e8b645a86191 Mon Sep 17 00:00:00 2001 From: Spikatrix <12792882+Spikatrix@users.noreply.github.com> Date: Sat, 10 Jun 2023 05:46:02 +0000 Subject: [PATCH] Use the ref api to check if a tag exists --- src/main.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index e14a031d..a2d8fd71 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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 = @@ -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) {