From b3ab63a88b133ee4dd8044af5823c14b49d0b82a Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Thu, 27 Jun 2024 12:37:50 -0500 Subject: [PATCH] fix: Fix temp env only being included for the `labeled` event --- dist/index.js | 11 +++++++---- src/index.js | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 58f52d4..825d187 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36945,10 +36945,13 @@ try { if (github.context.eventName === "pull_request") { const prEvent = github.context.payload; const targetLabel = value.label || prEvent.label?.name; - if ( - prEvent.action === "labeled" && - prEvent.label.name === targetLabel - ) { + const hasLabel = + (prEvent.action === "labeled" && + prEvent.label.name === targetLabel) || + prEvent.pull_request.labels.some( + (label) => label.name === targetLabel, + ); + if (hasLabel) { patterns = ref; value.name = `${value.name || toTitleCase(env)} #${prEvent.number}`; env += prEvent.number; diff --git a/src/index.js b/src/index.js index c3226eb..2ae1444 100644 --- a/src/index.js +++ b/src/index.js @@ -32,10 +32,13 @@ try { if (github.context.eventName === "pull_request") { const prEvent = github.context.payload; const targetLabel = value.label || prEvent.label?.name; - if ( - prEvent.action === "labeled" && - prEvent.label.name === targetLabel - ) { + const hasLabel = + (prEvent.action === "labeled" && + prEvent.label.name === targetLabel) || + prEvent.pull_request.labels.some( + (label) => label.name === targetLabel, + ); + if (hasLabel) { patterns = ref; value.name = `${value.name || toTitleCase(env)} #${prEvent.number}`; env += prEvent.number;