Skip to content

Commit 56b76f4

Browse files
authored
fix(scripts): process commits since origin/main in test:e2e:legacy:preview (#6539)
1 parent 2990ea8 commit 56b76f4

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

tests/e2e-legacy/preview.mjs

+14-7
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,24 @@ import { runTestForTags } from "./runTestForTags.mjs";
99
const __dirname = getDirName();
1010

1111
const execOptions = { ...process, cwd: __dirname, encoding: "utf-8" };
12-
const commitMessage = execSync(`git show -s --format=%s`, execOptions);
13-
const prefix = commitMessage.split(":")[0];
14-
const scope = prefix.substring(prefix.indexOf("(") + 1, prefix.indexOf(")"));
15-
console.info(`Updated scope: ${scope}`);
12+
const commitsSinceOriginHead = execSync(`git log --oneline origin/main..HEAD --format=%s`, execOptions).split("\n");
1613

17-
if (!scope) {
18-
console.info(`Couldn't find scope in commit message '${commitMessage}'`);
14+
const updatedClients = new Set();
15+
for (const commitMessage of commitsSinceOriginHead) {
16+
const prefix = commitMessage.split(":")[0];
17+
const scope = prefix.substring(prefix.indexOf("(") + 1, prefix.indexOf(")"));
18+
if (scope && scope.startsWith("client-")) {
19+
updatedClients.add(`@aws-sdk/${scope}`);
20+
}
21+
}
22+
console.info(`Updated packages: ${updatedClients}`);
23+
24+
if (updatedClients.size === 0) {
25+
console.info(`Couldn't find clients in commit messages:\n '${commitsSinceOriginHead.join("\n")}'`);
1926
process.exit(1);
2027
}
2128

2229
const allTags = getAllTags();
23-
const changedPackageTags = getPackageTags([`@aws-sdk/${scope}`]);
30+
const changedPackageTags = getPackageTags([...updatedClients]);
2431
const tagsToTest = changedPackageTags.filter((tag) => allTags.includes(tag));
2532
runTestForTags(tagsToTest);

0 commit comments

Comments
 (0)