Skip to content

Commit

Permalink
kie-issues#407: KIE Sandbox Accelerators break the current workspace …
Browse files Browse the repository at this point in the history
…if they fail to initialize (#2309)
  • Loading branch information
ljmotta authored May 13, 2024
1 parent 4f10bc5 commit cac3970
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/online-editor/src/accelerators/AcceleratorsHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,16 @@ export function useAcceleratorsDispatch(workspace: ActiveWorkspace) {
}

const workspaceFiles = await workspaces.getFiles({ workspaceId });

// Create new temporary branch with current files, but stay on current branch
// Create a backup branch with the current files, but stay on main
await workspaces.branch({ workspaceId, name: BACKUP_BRANCH_NAME, checkout: false });

// Commit files to backup branch (this commit will never be pushed, as this branch will be deleted)
// Adds all files to the staging area
await workspaces.stageFile({
workspaceId,
relativePath: ".",
});

// Commit staged changes to the backup branch
await workspaces.commit({
workspaceId,
commitMessage: `${env.KIE_SANDBOX_APP_NAME}: Backup files before applying ${accelerator.name} Accelerator`,
Expand Down

0 comments on commit cac3970

Please sign in to comment.