From 043929ee8fffa1dd1d619782a5a338cf39e76e23 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 28 May 2023 19:56:55 -0600 Subject: [PATCH] feat: add support for running on release event (#1191) Co-authored-by: GitHub Action --- dist/index.js | Bin 317645 -> 317848 bytes dist/index.js.map | Bin 373157 -> 373372 bytes src/commitSha.ts | 4 +++- src/env.ts | 6 ++++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index ba7a28421fa94cda29049472367ee0b5b71ace7f..1b16efb36051f4b92a6bd6b4432bcd6f8aaf5958 100644 GIT binary patch delta 228 zcmX@RQFz8?;SKDnlLg+0Xr|_s>A8D`c!WB|yN0>?g~SKB`nWmWQMmo_;sL3OfVqV(i-309K} z5?vJ9VFF|qc{lcU}E*sK&ZG~!byTPCVbzLOx$ zl9peTJ$XZt++-bVULL5%95dA mt1x+Eq8m$6VsYx^h(}t@Ym?g7CNTmr6A&|RUz^18x(ooA@HCJB diff --git a/dist/index.js.map b/dist/index.js.map index 48c4bf3b6b43844b0d45348a3a3a796633f6145f..b9fa31484273554ab7bdc4c9398b27175e8952d8 100644 GIT binary patch delta 261 zcmZ4bSnSUeu?;$0lMNL38FMx-TwuaDSs|W_(R_0u_pYbYmG&`-PG=Qn6qF2d^>K9! zc8w2l403l3iFfw*_4N$#4EC^|y#9;EX8zAgjGN0o9XDsuQHamlZmY%U!)%00i#~aekg&QEE>8U00$@#gtnI)OU8Pgx?GRjZy z)MXTAOq)Jemr-@PqaLI5^t-x@*3%d2F}h5T(POk{&jK2#5uY(#Qjbw%`VXK2mL!mg gZW|f3n2R$K!G^S(>N5f{6A&{4G0S#Seb#~|0M6W0Q2+n{ delta 193 zcmezKL~Q9}u?;$0lMA@Hn6e@_7V0sAn2e^IA8OV!P7HVm;%$D)8}N9$GY_LT3_8ud3pRoeVtr`tQ0gf z;?t&o&|}n?J`<>lEw3~;DYXcpZhE{JBL^o~S%!kG!t}R#jBYGRiN&eY-)>~oVlK`| Y1gmZ5F<=B@CLm@8VwUYZ2CM~50Kb(yc>n+a diff --git a/src/commitSha.ts b/src/commitSha.ts index 099c4331..70c3f862 100644 --- a/src/commitSha.ts +++ b/src/commitSha.ts @@ -83,7 +83,9 @@ export const getSHAForPushEvent = async ( core.info('Repository is shallow, fetching more history...') if (isTag) { - const sourceBranch = env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '') + const sourceBranch = + env.GITHUB_EVENT_BASE_REF.replace('refs/heads/', '') || + env.GITHUB_EVENT_RELEASE_TARGET_COMMITISH await gitFetch({ cwd: workingDirectory, args: [ diff --git a/src/env.ts b/src/env.ts index 02226c70..ddb8dbdf 100644 --- a/src/env.ts +++ b/src/env.ts @@ -8,6 +8,7 @@ export type Env = { GITHUB_REF_NAME: string GITHUB_REF: string GITHUB_EVENT_BASE_REF: string + GITHUB_EVENT_RELEASE_TARGET_COMMITISH: string GITHUB_EVENT_HEAD_REPO_FORK: string GITHUB_WORKSPACE: string GITHUB_EVENT_FORCED: string @@ -27,6 +28,9 @@ type GithubEvent = { } number: string } + release?: { + target_commitish: string + } before?: string base_ref?: string head_repo?: { @@ -49,6 +53,8 @@ export const getEnv = async (): Promise => { GITHUB_EVENT_PULL_REQUEST_BASE_REF: eventJson.pull_request?.base?.ref || '', GITHUB_EVENT_BEFORE: eventJson.before || '', GITHUB_EVENT_BASE_REF: eventJson.base_ref || '', + GITHUB_EVENT_RELEASE_TARGET_COMMITISH: + eventJson.release?.target_commitish || '', GITHUB_EVENT_HEAD_REPO_FORK: eventJson.head_repo?.fork || '', GITHUB_EVENT_PULL_REQUEST_NUMBER: eventJson.pull_request?.number || '', GITHUB_EVENT_PULL_REQUEST_BASE_SHA: eventJson.pull_request?.base?.sha || '',