fix(core): Only check for folder changes when parentFolderId is present (#14618)

This commit is contained in:
Ricardo Espinoza
2025-04-17 08:08:12 -04:00
committed by GitHub
parent 1e0853b24a
commit 08e73d3aed
3 changed files with 104 additions and 15 deletions

View File

@@ -32,6 +32,7 @@ import {
getTrackingInformationFromPrePushResult,
getTrackingInformationFromPullResult,
getVariablesPath,
isWorkflowModified,
normalizeAndValidateSourceControlledFilePath,
sourceControlFoldersExistCheck,
} from './source-control-helper.ee';
@@ -571,25 +572,37 @@ export class SourceControlService {
);
const wfModifiedInEither: SourceControlWorkflowVersionId[] = [];
wfLocalVersionIds.forEach((local) => {
const mismatchingIds = wfRemoteVersionIds.find(
(remote) =>
remote.id === local.id &&
(remote.versionId !== local.versionId || remote.parentFolderId !== local.parentFolderId),
wfLocalVersionIds.forEach((localWorkflow) => {
const remoteWorkflowWithSameId = wfRemoteVersionIds.find(
(removeWorkflow) => removeWorkflow.id === localWorkflow.id,
);
let name = (options?.preferLocalVersion ? local?.name : mismatchingIds?.name) ?? 'Workflow';
if (local.name && mismatchingIds?.name && local.name !== mismatchingIds.name) {
name = options?.preferLocalVersion
? `${local.name} (Remote: ${mismatchingIds.name})`
: (name = `${mismatchingIds.name} (Local: ${local.name})`);
if (!remoteWorkflowWithSameId) {
return;
}
if (mismatchingIds) {
if (isWorkflowModified(localWorkflow, remoteWorkflowWithSameId)) {
let name =
(options?.preferLocalVersion ? localWorkflow?.name : remoteWorkflowWithSameId?.name) ??
'Workflow';
if (
localWorkflow.name &&
remoteWorkflowWithSameId?.name &&
localWorkflow.name !== remoteWorkflowWithSameId.name
) {
name = options?.preferLocalVersion
? `${localWorkflow.name} (Remote: ${remoteWorkflowWithSameId.name})`
: (name = `${remoteWorkflowWithSameId.name} (Local: ${localWorkflow.name})`);
}
wfModifiedInEither.push({
...local,
...localWorkflow,
name,
versionId: options.preferLocalVersion ? local.versionId : mismatchingIds.versionId,
localId: local.versionId,
remoteId: mismatchingIds.versionId,
versionId: options.preferLocalVersion
? localWorkflow.versionId
: remoteWorkflowWithSameId.versionId,
localId: localWorkflow.versionId,
remoteId: remoteWorkflowWithSameId.versionId,
});
}
});