incorporate code review feedback: nesting depth

Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
Matt Benson
2024-10-01 16:01:33 -05:00
committed by blam
parent 7cdbb244a1
commit 5b6feba582
@@ -51,24 +51,23 @@ async function getFileAction(
): Promise<'create' | 'delete' | 'update' | 'skip'> {
if (defaultCommitAction === 'auto') {
const filePath = path.join(fileInfo.targetPath ?? '', fileInfo.file.path);
if (remoteFiles) {
if (remoteFiles.some(remoteFile => remoteFile.path === filePath)) {
try {
const targetFile = await api.RepositoryFiles.show(
target.repoID,
filePath,
target.branch,
);
if (computeSha256(fileInfo.file) === targetFile.content_sha256) {
return 'skip';
}
} catch (error) {
ctx.logger.warn(
`Unable to retrieve detailed information for remote file ${filePath}`,
);
if (remoteFiles?.some(remoteFile => remoteFile.path === filePath)) {
try {
const targetFile = await api.RepositoryFiles.show(
target.repoID,
filePath,
target.branch,
);
if (computeSha256(fileInfo.file) === targetFile.content_sha256) {
return 'skip';
}
return 'update';
} catch (error) {
ctx.logger.warn(
`Unable to retrieve detailed information for remote file ${filePath}`,
);
}
return 'update';
}
return 'create';
}