From ac749f08eb57413de4d127d9e66f64a0389ff36f Mon Sep 17 00:00:00 2001 From: Federico Paterno Date: Fri, 8 May 2026 13:41:12 +1000 Subject: [PATCH] fix: bugs on setGitEnvironmentVariables --- src/env.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/env.ts b/src/env.ts index 706fd051..3c0e488b 100644 --- a/src/env.ts +++ b/src/env.ts @@ -55,20 +55,20 @@ export function setGitEnvironmentVariables( hash = gitCommitShaOverride; } if (gitRepoUrlOverride) { - log.debug(`Using git repo URL override. Will be ${gitRepoUrlOverride} instead of ${hash}`); + log.debug(`Using git repo URL override. Will be ${gitRepoUrlOverride} instead of ${gitRepoUrl}`); gitRepoUrl = gitRepoUrlOverride; } if (hash == "" || gitRepoUrl == "") return; // We're using an any type here because AWS does not expose the `environment` field in their type + const gitTags = `git.commit.sha:${hash},git.repository_url:${gitRepoUrl}`; lambdas.forEach((lam) => { - if (lam.environment[DD_TAGS] !== undefined) { - lam.environment[DD_TAGS].value += `,git.commit.sha:${hash}`; + if (lam.environment[DD_TAGS] === undefined) { + lam.addEnvironment(DD_TAGS, gitTags); } else { - lam.addEnvironment(DD_TAGS, `git.commit.sha:${hash}`); + lam.environment[DD_TAGS].value += `,${gitTags}`; } - lam.environment[DD_TAGS].value += `,git.repository_url:${gitRepoUrl}`; }); }