Skip to content

Commit fcfc225

Browse files
committed
Move the conflicts resolution logic inside the checkForConflicts condition
1 parent b2056e6 commit fcfc225

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/modules/promote.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,24 @@ const throwIfIsMaster = (workspace: string) => {
2626
}
2727
}
2828

29+
/* This function is very specific to solve conflicts in the pages graphql app.
30+
The primary conflict resolution strategy at the file level
31+
is insufficient for safely resolving conflicts in the pages GraphQL application.
32+
All conflicts resolved here is using a mineWins strategy at the content json level.
33+
*/
2934
const handleConflict = async () => {
30-
const conflictsFound = await vbase.checkForConflicts()
35+
const conflictsFoundForPagesGraphql = await vbase.checkForConflicts()
3136

32-
if (conflictsFound) {
33-
await axios.get(workspaceUrl)
34-
}
37+
if (!conflictsFoundForPagesGraphql) return
38+
39+
// Forcing rebase to avoid conflicts
40+
await axios.get(workspaceUrl)
3541

3642
// @vtex/api expects a full implementation of the client, so we need to cast it to any.
3743
// The partial implementation is enough to solve conflicts.
3844
const conflictsResolver = new MineWinsConflictsResolver((vbase as Partial<VBase>) as any, 'userData', '')
3945

40-
await conflictsResolver.resolveAll()
46+
return conflictsResolver.resolveAll()
4147
}
4248

4349
const isPromotable = async (workspace: string) => {

0 commit comments

Comments
 (0)