Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const modifiedFiles: string[] | undefined = statusResult.modifiedFiles;
if (modifiedFiles) {
changedFiles.push(...modifiedFiles);
}
}
if (packBaseReference === packHeadReference) {
if (rawToPack) {
_logger.logWarn(`The base-reference "${packBaseReference}" is equal to the head-reference "${packHeadReference}". This will result in nothing getting packed because there won't be any changes detected. Please change either the base or head-reference.`);
} else {
toPack = PackagesToPack.DifferentVersion;
_logger.log(`The base-reference "${packBaseReference}" is equal to the head-reference "${packHeadReference}" which means there won't be any changes to pack. Switching "to-pack" to be "${PackagesToPack[toPack]}".`);
}
} else {
const diffResult: GitDiffResult = gitDiff(packBaseReference, packHeadReference, runOptions);
changedFiles.push(...diffResult.filesChanged);
if (!changedFiles || changedFiles.length === 0) {
_logger.logTrace(`Found no changes between "${packBaseReference}" and "${packHeadReference}".`);
} else {
_logger.logTrace(`Found the following changed files`)
for (const changedFilePath of changedFiles) {
_logger.logTrace(changedFilePath);
}
}
}
}
const packageFolderRoot: string = path.resolve(__dirname, "sdk");
_logger.logTrace(`INFO: Searching for package folders in ${packageFolderRoot}`);
const packageFolderPaths: string[] | undefined = getPackageFolderPaths(packageFolderRoot);
if (!packageFolderPaths) {
logger.logInfo(`No head-reference argument specified on command line or in environment variables. Defaulting to "${headReference}".`);
const modifiedFiles: string[] | undefined = statusResult.modifiedFiles;
if (modifiedFiles) {
changedFiles.push(...modifiedFiles);
}
}
let baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" });
if (!baseReference) {
baseReference = "master";
logger.logInfo(`No base-reference argument specified on command line or in environment variables. Defaulting to "${baseReference}".`);
}
if (baseReference !== headReference) {
const diffResult: GitDiffResult = gitDiff(baseReference, headReference);
changedFiles.push(...diffResult.filesChanged);
if (!changedFiles || changedFiles.length === 0) {
logger.logInfo(`Found no changes between "${baseReference}" and "${headReference}".`);
} else {
logger.logVerbose(`Found the following changed files`)
for (const changedFilePath of changedFiles) {
logger.logVerbose(changedFilePath);
}
}
}
const repositoryFolderPath: string = resolvePath(__dirname, "..");
const packagesFolderPath: string = joinPath(repositoryFolderPath, "sdk");
const packageFolderPaths: string[] | undefined = getPackageFolderPaths(packagesFolderPath);
let exitCode: number = 0;