Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scripts): process commits since origin/main in test:e2e:legacy:preview #6539

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions tests/e2e-legacy/preview.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Loading