Skip to content

Commit 4bcb0da

Browse files
committed
Deploy Production Code for Commit c30eaca 🚀
1 parent c30eaca commit 4bcb0da

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

lib/execute.d.ts

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
/**
2+
* The output of a command.
3+
*/
14
type ExecuteOutput = {
5+
/**
6+
* The standard output of the command.
7+
*/
28
stdout: string;
9+
/**
10+
* The standard error of the command.
11+
*/
312
stderr: string;
413
};
514
/** Wrapper around the GitHub toolkit exec command which returns the output.
@@ -12,6 +21,12 @@ type ExecuteOutput = {
1221
* on a non-zero exit status or to leave implementation up to the caller.
1322
*/
1423
export declare function execute(cmd: string, cwd: string, silent: boolean, ignoreReturnCode?: boolean): Promise<ExecuteOutput>;
24+
/**
25+
* Writes the output of a command to the stdout buffer.
26+
*/
1527
export declare function stdout(data: Buffer | string): void;
28+
/**
29+
* Writes the output of a command to the stderr buffer.
30+
*/
1631
export declare function stderr(data: Buffer | string): void;
1732
export {};

lib/execute.js

+6
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,19 @@ function execute(cmd_1, cwd_1, silent_1) {
4141
return Promise.resolve(output);
4242
});
4343
}
44+
/**
45+
* Writes the output of a command to the stdout buffer.
46+
*/
4447
function stdout(data) {
4548
const dataString = data.toString().trim();
4649
if (output.stdout.length + dataString.length <
4750
buffer_1.default.constants.MAX_STRING_LENGTH) {
4851
output.stdout += dataString;
4952
}
5053
}
54+
/**
55+
* Writes the output of a command to the stderr buffer.
56+
*/
5157
function stderr(data) {
5258
const dataString = data.toString().trim();
5359
if (output.stderr.length + dataString.length <

lib/git.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,24 @@ function init(action) {
2929
try {
3030
(0, core_1.info)(`Deploying using ${action.tokenType}… 🔑`);
3131
(0, core_1.info)('Configuring git…');
32+
/**
33+
* Add safe directory to the global git config.
34+
*/
3235
try {
33-
yield (0, execute_1.execute)(`git config --global --add safe.directory "${action.workspace}"`, action.workspace, action.silent);
36+
yield (0, execute_1.execute)(`git config --global safe.directory '*'`, action.workspace, action.silent);
3437
}
3538
catch (_a) {
39+
(0, core_1.info)('Unable to set workflow file tree as a safe directory…');
40+
}
41+
/**
42+
* Ensure that the workspace is a safe directory, this is somewhat redundant as the action
43+
* will always set the workspace as a safe directory, but this is a fallback in case the action
44+
* fails to do so.
45+
*/
46+
try {
47+
yield (0, execute_1.execute)(`git config --global --add safe.directory "${action.workspace}"`, action.workspace, action.silent);
48+
}
49+
catch (_b) {
3650
(0, core_1.info)('Unable to set workspace as a safe directory…');
3751
}
3852
yield (0, execute_1.execute)(`git config user.name "${action.name}"`, action.workspace, action.silent);
@@ -49,7 +63,7 @@ function init(action) {
4963
throw new Error();
5064
}
5165
}
52-
catch (_b) {
66+
catch (_c) {
5367
(0, core_1.info)('Unable to unset previous git config authentication as it may not exist, continuing…');
5468
}
5569
try {
@@ -58,7 +72,7 @@ function init(action) {
5872
throw new Error();
5973
}
6074
}
61-
catch (_c) {
75+
catch (_d) {
6276
(0, core_1.info)('Attempted to remove origin but failed, continuing…');
6377
}
6478
yield (0, execute_1.execute)(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);

0 commit comments

Comments
 (0)