Skip to content

Commit 5c6e9e9

Browse files
committed
Deploy Production Code for Commit e9abb9c 🚀
1 parent e9abb9c commit 5c6e9e9

File tree

362 files changed

+3307
-11697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+3307
-11697
lines changed

lib/worktree.d.ts

+25-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
11
import { ActionInterface } from './constants';
2+
/**
3+
* Git checkout command.
4+
*/
25
export declare class GitCheckout {
6+
/**
7+
* @param orphan - Bool indicating if the branch is an orphan.
8+
*/
39
orphan: boolean;
10+
/**
11+
* @param commitish - The commitish to check out.
12+
*/
413
commitish?: string | null;
14+
/**
15+
* @param branch - The branch name.
16+
*/
517
branch: string;
6-
constructor(branch: string);
18+
/**
19+
* @param branch - The branch name.
20+
* @param commitish - The commitish to check out.
21+
*/
22+
constructor(branch: string, commitish?: string);
23+
/**
24+
* Returns the string representation of the git checkout command.
25+
*/
726
toString(): string;
827
}
928
/**
10-
* Generate the worktree and set initial content if it exists
29+
* Generates a git worktree.
30+
* @param action - The action interface.
31+
* @param worktreedir - The worktree directory.
32+
* @param branchExists - Bool indicating if the branch exists.
1133
*/
12-
export declare function generateWorktree(action: ActionInterface, worktreedir: string, branchExists: unknown): Promise<void>;
34+
export declare function generateWorktree(action: ActionInterface, worktreedir: string, branchExists: boolean | number): Promise<void>;

lib/worktree.js

+35-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,29 @@ exports.generateWorktree = exports.GitCheckout = void 0;
1313
const core_1 = require("@actions/core");
1414
const execute_1 = require("./execute");
1515
const util_1 = require("./util");
16+
/**
17+
* Git checkout command.
18+
*/
1619
class GitCheckout {
17-
constructor(branch) {
20+
/**
21+
* @param branch - The branch name.
22+
* @param commitish - The commitish to check out.
23+
*/
24+
constructor(branch, commitish) {
25+
/**
26+
* @param orphan - Bool indicating if the branch is an orphan.
27+
*/
1828
this.orphan = false;
29+
/**
30+
* @param commitish - The commitish to check out.
31+
*/
1932
this.commitish = null;
2033
this.branch = branch;
34+
this.commitish = commitish || null;
2135
}
36+
/**
37+
* Returns the string representation of the git checkout command.
38+
*/
2239
toString() {
2340
return [
2441
'git',
@@ -31,7 +48,10 @@ class GitCheckout {
3148
}
3249
exports.GitCheckout = GitCheckout;
3350
/**
34-
* Generate the worktree and set initial content if it exists
51+
* Generates a git worktree.
52+
* @param action - The action interface.
53+
* @param worktreedir - The worktree directory.
54+
* @param branchExists - Bool indicating if the branch exists.
3555
*/
3656
function generateWorktree(action, worktreedir, branchExists) {
3757
return __awaiter(this, void 0, void 0, function* () {
@@ -41,7 +61,8 @@ function generateWorktree(action, worktreedir, branchExists) {
4161
yield (0, execute_1.execute)(`git fetch --no-recurse-submodules --depth=1 origin ${action.branch}`, action.workspace, action.silent);
4262
}
4363
yield (0, execute_1.execute)(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
44-
const checkout = new GitCheckout(action.branch);
64+
let branchName = action.branch;
65+
let checkout = new GitCheckout(branchName);
4566
if (branchExists) {
4667
// There's existing data on the branch to check out
4768
checkout.commitish = `origin/${action.branch}`;
@@ -52,14 +73,22 @@ function generateWorktree(action, worktreedir, branchExists) {
5273
If the ref name is the same as the branch name, do not attempt to create an orphan of it. */
5374
checkout.orphan = true;
5475
}
55-
yield (0, execute_1.execute)(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
76+
try {
77+
yield (0, execute_1.execute)(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
78+
}
79+
catch (error) {
80+
(0, core_1.info)('Error encountered while checking out branch. Attempting to continue with a new branch name.');
81+
branchName = `temp-${Date.now()}`;
82+
checkout = new GitCheckout(branchName, `origin/${action.branch}`);
83+
yield (0, execute_1.execute)(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
84+
}
5685
if (!branchExists) {
57-
(0, core_1.info)(`Created the ${action.branch} branch… 🔧`);
86+
(0, core_1.info)(`Created the ${branchName} branch… 🔧`);
5887
// Our index is in HEAD state, reset
5988
yield (0, execute_1.execute)('git reset --hard', `${action.workspace}/${worktreedir}`, action.silent);
6089
if (!action.singleCommit) {
6190
// New history isn't singleCommit, create empty initial commit
62-
yield (0, execute_1.execute)(`git commit --no-verify --allow-empty -m "Initial ${action.branch} commit"`, `${action.workspace}/${worktreedir}`, action.silent);
91+
yield (0, execute_1.execute)(`git commit --no-verify --allow-empty -m "Initial ${branchName} commit"`, `${action.workspace}/${worktreedir}`, action.silent);
6392
}
6493
}
6594
}

node_modules/.bin/semver

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@eslint/eslintrc/dist/eslintrc.cjs

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@eslint/eslintrc/lib/config-array-factory.js

+5-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@eslint/eslintrc/lib/index.js

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@eslint/eslintrc/node_modules/debug/LICENSE

-19
This file was deleted.

0 commit comments

Comments
 (0)