Skip to content

Commit 91f72e3

Browse files
committed
Deploy Production Code for Commit 77b5e66 🚀
1 parent 77b5e66 commit 91f72e3

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

lib/worktree.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,15 @@ function generateWorktree(action, worktreedir, branchExists) {
8080
catch (error) {
8181
(0, core_1.info)('Error encountered while checking out branch. Attempting to continue with a new branch name.');
8282
branchName = `temp-${Date.now()}`;
83-
checkout = new GitCheckout(branchName);
84-
yield (0, execute_1.execute)(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
83+
try {
84+
checkout = new GitCheckout(branchName, `origin/${action.branch}`);
85+
yield (0, execute_1.execute)(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
86+
}
87+
catch (error) {
88+
(0, core_1.info)('Unable to track the origin branch…');
89+
checkout = new GitCheckout(branchName);
90+
yield (0, execute_1.execute)(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
91+
}
8592
}
8693
if (!branchExists) {
8794
(0, core_1.info)(`Created the ${branchName} branch… 🔧`);
@@ -91,15 +98,15 @@ function generateWorktree(action, worktreedir, branchExists) {
9198
// New history isn't singleCommit, create empty initial commit
9299
yield (0, execute_1.execute)(`git commit --no-verify --allow-empty -m "Initial ${branchName} commit"`, `${action.workspace}/${worktreedir}`, action.silent);
93100
}
94-
/**
95-
* Ensure that the workspace is a safe directory.
96-
*/
97-
try {
98-
yield (0, execute_1.execute)(`git config --global --add safe.directory "${action.workspace}/${worktreedir}"`, action.workspace, action.silent);
99-
}
100-
catch (_a) {
101-
(0, core_1.info)('Unable to set worktree temp directory as a safe directory…');
102-
}
101+
}
102+
/**
103+
* Ensure that the workspace is a safe directory.
104+
*/
105+
try {
106+
yield (0, execute_1.execute)(`git config --global --add safe.directory "${action.workspace}/${worktreedir}"`, action.workspace, action.silent);
107+
}
108+
catch (_a) {
109+
(0, core_1.info)('Unable to set worktree temp directory as a safe directory…');
103110
}
104111
}
105112
catch (error) {

0 commit comments

Comments
 (0)