Skip to content

Commit

Permalink
Merge branch 'releases/v4-flow' of https://github.com/JamesIves/githu…
Browse files Browse the repository at this point in the history
…b-pages-deploy-action into releases/v4-flow
  • Loading branch information
JamesIves committed May 18, 2024
2 parents bbaccba + 69238e0 commit c8e24b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
1 change: 0 additions & 1 deletion lib/execute.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
type ExecuteOutput = {
stdout: string;
stderr: string;
exitCode: number;
};
/** Wrapper around the GitHub toolkit exec command which returns the output.
* Also allows you to easily toggle the current working directory.
Expand Down
13 changes: 3 additions & 10 deletions lib/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.stderr = exports.stdout = exports.execute = void 0;
const exec_1 = require("@actions/exec");
const buffer_1 = __importDefault(require("buffer"));
const output = { stdout: '', stderr: '', exitCode: 0 };
const output = { stdout: '', stderr: '' };
/** Wrapper around the GitHub toolkit exec command which returns the output.
* Also allows you to easily toggle the current working directory.
*
Expand All @@ -29,18 +29,11 @@ function execute(cmd_1, cwd_1, silent_1) {
return __awaiter(this, arguments, void 0, function* (cmd, cwd, silent, ignoreReturnCode = false) {
output.stdout = '';
output.stderr = '';
output.exitCode = yield (0, exec_1.exec)(cmd, [], {
yield (0, exec_1.exec)(cmd, [], {
// Silences the input unless the INPUT_DEBUG flag is set.
silent,
cwd,
listeners: {
stdout: (data) => {
stdout(data);
},
stderr: (data) => {
stderr(data);
}
},
listeners: { stdout, stderr },
ignoreReturnCode
});
return Promise.resolve(output);
Expand Down
7 changes: 1 addition & 6 deletions lib/worktree.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ function generateWorktree(action, worktreedir, branchExists) {
if (branchExists) {
yield (0, execute_1.execute)(`git fetch --no-recurse-submodules --depth=1 origin ${action.branch}`, action.workspace, action.silent);
}
// Check if the worktree already exists
const { exitCode } = yield (0, execute_1.execute)(`git worktree list | grep ${worktreedir}`, action.workspace, action.silent);
// If the worktree exists, remove it
if (exitCode === 0) {
yield (0, execute_1.execute)(`git worktree remove ${worktreedir}`, action.workspace, action.silent);
}
yield (0, execute_1.execute)(`git worktree remove ${worktreedir}`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
const checkout = new GitCheckout(action.branch);
if (branchExists) {
Expand Down

0 comments on commit c8e24b3

Please sign in to comment.