mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2026-05-31 00:12:03 +08:00
Deploy Production Code for Commit c30eaca625 🚀
This commit is contained in:
15
lib/execute.d.ts
vendored
15
lib/execute.d.ts
vendored
@@ -1,5 +1,14 @@
|
||||
/**
|
||||
* The output of a command.
|
||||
*/
|
||||
type ExecuteOutput = {
|
||||
/**
|
||||
* The standard output of the command.
|
||||
*/
|
||||
stdout: string;
|
||||
/**
|
||||
* The standard error of the command.
|
||||
*/
|
||||
stderr: string;
|
||||
};
|
||||
/** Wrapper around the GitHub toolkit exec command which returns the output.
|
||||
@@ -12,6 +21,12 @@ type ExecuteOutput = {
|
||||
* on a non-zero exit status or to leave implementation up to the caller.
|
||||
*/
|
||||
export declare function execute(cmd: string, cwd: string, silent: boolean, ignoreReturnCode?: boolean): Promise<ExecuteOutput>;
|
||||
/**
|
||||
* Writes the output of a command to the stdout buffer.
|
||||
*/
|
||||
export declare function stdout(data: Buffer | string): void;
|
||||
/**
|
||||
* Writes the output of a command to the stderr buffer.
|
||||
*/
|
||||
export declare function stderr(data: Buffer | string): void;
|
||||
export {};
|
||||
|
||||
@@ -41,6 +41,9 @@ function execute(cmd_1, cwd_1, silent_1) {
|
||||
return Promise.resolve(output);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Writes the output of a command to the stdout buffer.
|
||||
*/
|
||||
function stdout(data) {
|
||||
const dataString = data.toString().trim();
|
||||
if (output.stdout.length + dataString.length <
|
||||
@@ -48,6 +51,9 @@ function stdout(data) {
|
||||
output.stdout += dataString;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Writes the output of a command to the stderr buffer.
|
||||
*/
|
||||
function stderr(data) {
|
||||
const dataString = data.toString().trim();
|
||||
if (output.stderr.length + dataString.length <
|
||||
|
||||
20
lib/git.js
20
lib/git.js
@@ -29,10 +29,24 @@ function init(action) {
|
||||
try {
|
||||
(0, core_1.info)(`Deploying using ${action.tokenType}… 🔑`);
|
||||
(0, core_1.info)('Configuring git…');
|
||||
/**
|
||||
* Add safe directory to the global git config.
|
||||
*/
|
||||
try {
|
||||
yield (0, execute_1.execute)(`git config --global safe.directory '*'`, action.workspace, action.silent);
|
||||
}
|
||||
catch (_a) {
|
||||
(0, core_1.info)('Unable to set workflow file tree as a safe directory…');
|
||||
}
|
||||
/**
|
||||
* Ensure that the workspace is a safe directory, this is somewhat redundant as the action
|
||||
* will always set the workspace as a safe directory, but this is a fallback in case the action
|
||||
* fails to do so.
|
||||
*/
|
||||
try {
|
||||
yield (0, execute_1.execute)(`git config --global --add safe.directory "${action.workspace}"`, action.workspace, action.silent);
|
||||
}
|
||||
catch (_a) {
|
||||
catch (_b) {
|
||||
(0, core_1.info)('Unable to set workspace as a safe directory…');
|
||||
}
|
||||
yield (0, execute_1.execute)(`git config user.name "${action.name}"`, action.workspace, action.silent);
|
||||
@@ -49,7 +63,7 @@ function init(action) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
catch (_b) {
|
||||
catch (_c) {
|
||||
(0, core_1.info)('Unable to unset previous git config authentication as it may not exist, continuing…');
|
||||
}
|
||||
try {
|
||||
@@ -58,7 +72,7 @@ function init(action) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
catch (_c) {
|
||||
catch (_d) {
|
||||
(0, core_1.info)('Attempted to remove origin but failed, continuing…');
|
||||
}
|
||||
yield (0, execute_1.execute)(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);
|
||||
|
||||
Reference in New Issue
Block a user