diff --git a/src/modules/promote.ts b/src/modules/promote.ts index 95739b4..a3e08fd 100644 --- a/src/modules/promote.ts +++ b/src/modules/promote.ts @@ -26,18 +26,24 @@ const throwIfIsMaster = (workspace: string) => { } } +/* This function is very specific to solve conflicts in the pages graphql app. + The primary conflict resolution strategy at the file level + is insufficient for safely resolving conflicts in the pages GraphQL application. + All conflicts resolved here is using a mineWins strategy at the content json level. +*/ const handleConflict = async () => { - const conflictsFound = await vbase.checkForConflicts() + const conflictsFoundForPagesGraphql = await vbase.checkForConflicts() - if (conflictsFound) { - await axios.get(workspaceUrl) - } + if (!conflictsFoundForPagesGraphql) return + + // Forcing rebase to avoid conflicts + await axios.get(workspaceUrl) // @vtex/api expects a full implementation of the client, so we need to cast it to any. // The partial implementation is enough to solve conflicts. const conflictsResolver = new MineWinsConflictsResolver((vbase as Partial) as any, 'userData', '') - await conflictsResolver.resolveAll() + return conflictsResolver.resolveAll() } const isPromotable = async (workspace: string) => {