diff --git a/lib/git.js b/lib/git.js index 244ecd18..25632bd1 100644 --- a/lib/git.js +++ b/lib/git.js @@ -52,8 +52,8 @@ function generateBranch() { return __awaiter(this, void 0, void 0, function* () { try { console.log(`Creating ${constants_1.action.branch} branch...`); - yield util_1.execute(`git checkout ${constants_1.action.baseBranch || "master"} ---`, constants_1.workspace); - yield util_1.execute(`git checkout --orphan ${constants_1.action.branch} ---`, constants_1.workspace); + yield util_1.execute(`git switch ${constants_1.action.baseBranch || "master"}`, constants_1.workspace); + yield util_1.execute(`git switch --orphan ${constants_1.action.branch}`, constants_1.workspace); yield util_1.execute(`git reset --hard`, constants_1.workspace); yield util_1.execute(`git commit --allow-empty -m "Initial ${constants_1.action.branch} commit."`, constants_1.workspace); yield util_1.execute(`git push ${constants_1.repositoryPath} ${constants_1.action.branch}`, constants_1.workspace); @@ -84,7 +84,7 @@ function deploy() { yield generateBranch(); } // Checks out the base branch to begin the deployment process. - yield util_1.execute(`git checkout ${constants_1.action.baseBranch || "master"} ---`, constants_1.workspace); + yield util_1.execute(`git switch ${constants_1.action.baseBranch || "master"}`, constants_1.workspace); yield util_1.execute(`git fetch origin`, constants_1.workspace); yield util_1.execute(`git worktree add --checkout ${temporaryDeploymentDirectory} origin/${constants_1.action.branch}`, constants_1.workspace); /* @@ -96,7 +96,7 @@ function deploy() { }); // Commits to GitHub. yield util_1.execute(`git add --all .`, temporaryDeploymentDirectory); - yield util_1.execute(`git checkout -b ${temporaryDeploymentBranch} ---`, temporaryDeploymentDirectory); + yield util_1.execute(`git switch -c ${temporaryDeploymentBranch}`, temporaryDeploymentDirectory); yield util_1.execute(`git commit -m "Deploying to ${constants_1.action.branch} from ${constants_1.action.baseBranch} ${process.env.GITHUB_SHA}" --quiet`, temporaryDeploymentDirectory); yield util_1.execute(`git push ${constants_1.repositoryPath} ${temporaryDeploymentBranch}:${constants_1.action.branch}`, temporaryDeploymentDirectory); return Promise.resolve("Commit step complete..."); diff --git a/src/git.ts b/src/git.ts index 41ef6c98..ff7f1303 100644 --- a/src/git.ts +++ b/src/git.ts @@ -36,8 +36,8 @@ export async function init(): Promise { export async function generateBranch(): Promise { try { console.log(`Creating ${action.branch} branch...`); - await execute(`git checkout ${action.baseBranch || "master"} ---`, workspace); - await execute(`git checkout --orphan ${action.branch} ---`, workspace); + await execute(`git switch ${action.baseBranch || "master"}`, workspace); + await execute(`git switch --orphan ${action.branch}`, workspace); await execute(`git reset --hard`, workspace); await execute( `git commit --allow-empty -m "Initial ${action.branch} commit."`, @@ -74,7 +74,7 @@ export async function deploy(): Promise { } // Checks out the base branch to begin the deployment process. - await execute(`git checkout ${action.baseBranch || "master"} ---`, workspace); + await execute(`git switch ${action.baseBranch || "master"}`, workspace); await execute(`git fetch origin`, workspace); await execute( `git worktree add --checkout ${temporaryDeploymentDirectory} origin/${action.branch}`, @@ -92,7 +92,7 @@ export async function deploy(): Promise { // Commits to GitHub. await execute(`git add --all .`, temporaryDeploymentDirectory); await execute( - `git checkout -b ${temporaryDeploymentBranch} ---`, + `git switch -c ${temporaryDeploymentBranch}`, temporaryDeploymentDirectory ); await execute(