improve efficiency when commit is explicitly skipped

Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
Matt Benson
2024-09-25 09:31:27 -05:00
committed by blam
parent 9adfe46759
commit 7cdbb244a1
@@ -276,33 +276,36 @@ which uses additional API calls in order to detect whether to 'create', 'update'
}
}
const actions: Types.CommitAction[] = (
(
await Promise.all(
fileContents.map(async file =>
getFileAction(
{ file, targetPath },
{ repoID, branch: targetBranch! },
api,
ctx,
remoteFiles,
ctx.input.commitAction,
).then(action => ({ file, action })),
),
)
).filter(o => o.action !== 'skip') as {
file: SerializedFile;
action: Types.CommitAction['action'];
}[]
).map(({ file, action }) => ({
action,
filePath: targetPath
? path.posix.join(targetPath, file.path)
: file.path,
encoding: 'base64',
content: file.content.toString('base64'),
execute_filemode: file.executable,
}));
const actions: Types.CommitAction[] =
ctx.input.commitAction === 'skip'
? []
: (
(
await Promise.all(
fileContents.map(async file =>
getFileAction(
{ file, targetPath },
{ repoID, branch: targetBranch! },
api,
ctx,
remoteFiles,
ctx.input.commitAction,
).then(action => ({ file, action })),
),
)
).filter(o => o.action !== 'skip') as {
file: SerializedFile;
action: Types.CommitAction['action'];
}[]
).map(({ file, action }) => ({
action,
filePath: targetPath
? path.posix.join(targetPath, file.path)
: file.path,
encoding: 'base64',
content: file.content.toString('base64'),
execute_filemode: file.executable,
}));
let createBranch: boolean;
if (actions.length) {