Skip to content

Commit fc8c70c

Browse files
committed
Deploy Production Code for Commit d418023 🚀
1 parent d418023 commit fc8c70c

Some content is hidden

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

67 files changed

+937
-541
lines changed

lib/execute.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
/// <reference types="node" />
12
/** Wrapper around the GitHub toolkit exec command which returns the output.
23
* Also allows you to easily toggle the current working directory.
34
*
45
* @param {string} cmd - The command to execute.
56
* @param {string} cwd - The current working directory.
67
* @param {boolean} silent - Determines if the in/out should be silenced or not.
78
*/
8-
export declare function execute(cmd: string, cwd: string, silent: boolean): Promise<any>;
9-
export declare function stdout(data: any): string | void;
9+
export declare function execute(cmd: string, cwd: string, silent: boolean): Promise<string>;
10+
export declare function stdout(data: Buffer | string): void;

lib/execute.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
88
step((generator = generator.apply(thisArg, _arguments || [])).next());
99
});
1010
};
11+
var __importDefault = (this && this.__importDefault) || function (mod) {
12+
return (mod && mod.__esModule) ? mod : { "default": mod };
13+
};
1114
Object.defineProperty(exports, "__esModule", { value: true });
1215
exports.stdout = exports.execute = void 0;
1316
const exec_1 = require("@actions/exec");
14-
let output;
17+
const buffer_1 = __importDefault(require("buffer"));
18+
let output = '';
1519
/** Wrapper around the GitHub toolkit exec command which returns the output.
1620
* Also allows you to easily toggle the current working directory.
1721
*
@@ -35,6 +39,8 @@ function execute(cmd, cwd, silent) {
3539
}
3640
exports.execute = execute;
3741
function stdout(data) {
38-
output += data.toString().trim();
42+
if (output.length < buffer_1.default.constants.MAX_STRING_LENGTH) {
43+
output += data.toString().trim();
44+
}
3945
}
4046
exports.stdout = stdout;

lib/git.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function deploy(action) {
7676
: ''} 🚀`;
7777
// Checks to see if the remote exists prior to deploying.
7878
const branchExists = action.isTest & constants_1.TestFlag.HAS_REMOTE_BRANCH ||
79-
(yield execute_1.execute(`git ls-remote --heads ${action.repositoryPath} ${action.branch}`, action.workspace, action.silent));
79+
(yield execute_1.execute(`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`, action.workspace, action.silent));
8080
yield worktree_1.generateWorktree(action, temporaryDeploymentDirectory, branchExists);
8181
// Ensures that items that need to be excluded from the clean job get parsed.
8282
let excludes = '';
@@ -115,7 +115,9 @@ function deploy(action) {
115115
const hasFilesToCommit = action.isTest & constants_1.TestFlag.HAS_CHANGED_FILES ||
116116
(yield execute_1.execute(checkGitStatus, `${action.workspace}/${temporaryDeploymentDirectory}`, true // This output is always silenced due to the large output it creates.
117117
));
118-
if (!hasFilesToCommit) {
118+
if ((!action.singleCommit && !hasFilesToCommit) ||
119+
// Ignores the case where single commit is true with a target folder to prevent incorrect early exiting.
120+
(action.singleCommit && !action.targetFolder && !hasFilesToCommit)) {
119121
return constants_1.Status.SKIPPED;
120122
}
121123
// Commits to GitHub.
@@ -134,6 +136,11 @@ function deploy(action) {
134136
finally {
135137
// Cleans up temporary files/folders and restores the git state.
136138
core_1.info('Running post deployment cleanup jobs… 🗑️');
139+
if (!action.singleCommit) {
140+
core_1.info(`Resetting branch and removing artifacts…`);
141+
yield execute_1.execute(`git checkout -B ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
142+
yield execute_1.execute(`git branch -D ${action.branch} --force`, action.workspace, action.silent);
143+
}
137144
yield execute_1.execute(`git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, action.silent);
138145
yield io_1.rmRF(temporaryDeploymentDirectory);
139146
}

lib/util.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ActionInterface } from './constants';
2-
export declare const isNullOrUndefined: (value: any) => boolean;
2+
export declare const isNullOrUndefined: (value: unknown) => boolean;
33
export declare const generateTokenType: (action: ActionInterface) => string;
44
export declare const generateRepositoryPath: (action: ActionInterface) => string;
55
export declare const generateFolderPath: (action: ActionInterface) => string;

lib/worktree.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export declare class GitCheckout {
66
constructor(branch: string);
77
toString(): string;
88
}
9-
export declare function generateWorktree(action: ActionInterface, worktreedir: string, branchExists: boolean): Promise<void>;
9+
export declare function generateWorktree(action: ActionInterface, worktreedir: string, branchExists: unknown): Promise<void>;

node_modules/@actions/core/README.md

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

node_modules/@actions/core/lib/core.js

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

node_modules/@actions/core/lib/core.js.map

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

node_modules/@actions/core/package.json

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

node_modules/@actions/io/LICENSE.md

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

node_modules/@actions/io/lib/io-util.js

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

0 commit comments

Comments
 (0)