From 56b76f47086f0331eab8f06b2053f8da1b972fbf Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Thu, 3 Oct 2024 07:20:32 -0700 Subject: [PATCH] fix(scripts): process commits since origin/main in test:e2e:legacy:preview (#6539) --- tests/e2e-legacy/preview.mjs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/e2e-legacy/preview.mjs b/tests/e2e-legacy/preview.mjs index 8f2b78f8c9ba..db864e76c8a7 100755 --- a/tests/e2e-legacy/preview.mjs +++ b/tests/e2e-legacy/preview.mjs @@ -9,17 +9,24 @@ import { runTestForTags } from "./runTestForTags.mjs"; const __dirname = getDirName(); const execOptions = { ...process, cwd: __dirname, encoding: "utf-8" }; -const commitMessage = execSync(`git show -s --format=%s`, execOptions); -const prefix = commitMessage.split(":")[0]; -const scope = prefix.substring(prefix.indexOf("(") + 1, prefix.indexOf(")")); -console.info(`Updated scope: ${scope}`); +const commitsSinceOriginHead = execSync(`git log --oneline origin/main..HEAD --format=%s`, execOptions).split("\n"); -if (!scope) { - console.info(`Couldn't find scope in commit message '${commitMessage}'`); +const updatedClients = new Set(); +for (const commitMessage of commitsSinceOriginHead) { + const prefix = commitMessage.split(":")[0]; + const scope = prefix.substring(prefix.indexOf("(") + 1, prefix.indexOf(")")); + if (scope && scope.startsWith("client-")) { + updatedClients.add(`@aws-sdk/${scope}`); + } +} +console.info(`Updated packages: ${updatedClients}`); + +if (updatedClients.size === 0) { + console.info(`Couldn't find clients in commit messages:\n '${commitsSinceOriginHead.join("\n")}'`); process.exit(1); } const allTags = getAllTags(); -const changedPackageTags = getPackageTags([`@aws-sdk/${scope}`]); +const changedPackageTags = getPackageTags([...updatedClients]); const tagsToTest = changedPackageTags.filter((tag) => allTags.includes(tag)); runTestForTags(tagsToTest);