Skip to content

Commit 7f4b5e0

Browse files
fix: undefined param
1 parent 2efc510 commit 7f4b5e0

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

lib/utils/command.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,29 @@ const path_1 = __importDefault(require("path"));
1616
const signale_1 = __importDefault(require("signale"));
1717
const child_process_1 = require("child_process");
1818
const misc_1 = require("./misc");
19-
exports.deploy = (name, context) => __awaiter(this, void 0, void 0, function* () {
19+
exports.deploy = (branch, context) => __awaiter(this, void 0, void 0, function* () {
2020
const workDir = path_1.default.resolve(misc_1.getWorkspace(), '.work');
2121
const buildDir = path_1.default.resolve(workDir, 'build');
2222
const pushDir = path_1.default.resolve(workDir, 'build');
23-
signale_1.default.info(`Deploying branch %s to %s`, name, misc_1.getRepository(context));
23+
signale_1.default.info(`Deploying branch %s to %s`, branch, misc_1.getRepository(context));
2424
fs_1.default.mkdirSync(pushDir, { recursive: true });
2525
yield exports.prepareFiles(buildDir, pushDir, context);
26-
yield cloneForBranch(pushDir, name, context);
26+
yield cloneForBranch(pushDir, branch, context);
2727
yield copyFiles(buildDir, pushDir);
2828
yield config(pushDir);
2929
yield commit(pushDir);
30-
yield push(pushDir, name, context);
30+
yield push(pushDir, branch, context);
3131
});
3232
exports.prepareFiles = (buildDir, pushDir, context) => __awaiter(this, void 0, void 0, function* () {
33-
signale_1.default.info('Preparing files for release', name);
33+
signale_1.default.info('Preparing files for release');
3434
fs_1.default.mkdirSync(buildDir, { recursive: true });
3535
yield cloneForBuild(buildDir, context);
3636
yield runBuild(buildDir);
3737
});
38-
const cloneForBranch = (pushDir, name, context) => __awaiter(this, void 0, void 0, function* () {
39-
signale_1.default.info(`Cloning the branch %s from the remote repo`, name);
38+
const cloneForBranch = (pushDir, branch, context) => __awaiter(this, void 0, void 0, function* () {
39+
signale_1.default.info(`Cloning the branch %s from the remote repo`, branch);
4040
const url = misc_1.getGitUrl(context);
41-
yield execAsync(`git -C ${pushDir} clone --quiet --branch=${name} --depth=1 ${url} .`, true);
41+
yield execAsync(`git -C ${pushDir} clone --quiet --branch=${branch} --depth=1 ${url} .`, true);
4242
});
4343
const config = (pushDir) => __awaiter(this, void 0, void 0, function* () {
4444
const name = misc_1.getCommitName();
@@ -53,10 +53,10 @@ const commit = (pushDir) => __awaiter(this, void 0, void 0, function* () {
5353
yield execAsync(`git -C ${pushDir} commit -qm "${message}"`);
5454
yield execAsync(`git -C ${pushDir} show --stat-count=10 HEAD`);
5555
});
56-
const push = (pushDir, name, context) => __awaiter(this, void 0, void 0, function* () {
57-
signale_1.default.info('Pushing to %s@%s', misc_1.getRepository(context), name);
56+
const push = (pushDir, branch, context) => __awaiter(this, void 0, void 0, function* () {
57+
signale_1.default.info('Pushing to %s@%s', misc_1.getRepository(context), branch);
5858
const url = misc_1.getGitUrl(context);
59-
yield execAsync(`git -C ${pushDir} push --quiet "${url}" "${name}":"${name}"`, true);
59+
yield execAsync(`git -C ${pushDir} push --quiet "${url}" "${branch}":"${branch}"`, true);
6060
});
6161
const cloneForBuild = (buildDir, context) => __awaiter(this, void 0, void 0, function* () {
6262
signale_1.default.info('Cloning the working commit from the remote repo for build');

src/utils/command.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ import {exec} from 'child_process';
55
import {Context} from '@actions/github/lib/context';
66
import {getGitUrl, getRepository, getBuildCommands, getWorkspace, getCommitMessage, getCommitName, getCommitEmail, detectBuildCommand} from './misc';
77

8-
export const deploy = async (name: string, context: Context) => {
8+
export const deploy = async (branch: string, context: Context) => {
99
const workDir = path.resolve(getWorkspace(), '.work');
1010
const buildDir = path.resolve(workDir, 'build');
1111
const pushDir = path.resolve(workDir, 'build');
12-
signale.info(`Deploying branch %s to %s`, name, getRepository(context));
12+
signale.info(`Deploying branch %s to %s`, branch, getRepository(context));
1313

1414
fs.mkdirSync(pushDir, {recursive: true});
1515
await prepareFiles(buildDir, pushDir, context);
16-
await cloneForBranch(pushDir, name, context);
16+
await cloneForBranch(pushDir, branch, context);
1717
await copyFiles(buildDir, pushDir);
1818
await config(pushDir);
1919
await commit(pushDir);
20-
await push(pushDir, name, context);
20+
await push(pushDir, branch, context);
2121
};
2222

2323
export const prepareFiles = async (buildDir: string, pushDir: string, context: Context) => {
24-
signale.info('Preparing files for release', name);
24+
signale.info('Preparing files for release');
2525

2626
fs.mkdirSync(buildDir, {recursive: true});
2727
await cloneForBuild(buildDir, context);
2828
await runBuild(buildDir);
2929
};
3030

31-
const cloneForBranch = async (pushDir: string, name: string, context: Context) => {
32-
signale.info(`Cloning the branch %s from the remote repo`, name);
31+
const cloneForBranch = async (pushDir: string, branch: string, context: Context) => {
32+
signale.info(`Cloning the branch %s from the remote repo`, branch);
3333

3434
const url = getGitUrl(context);
35-
await execAsync(`git -C ${pushDir} clone --quiet --branch=${name} --depth=1 ${url} .`, true);
35+
await execAsync(`git -C ${pushDir} clone --quiet --branch=${branch} --depth=1 ${url} .`, true);
3636
};
3737

3838
const config = async (pushDir: string) => {
@@ -51,11 +51,11 @@ const commit = async (pushDir: string) => {
5151
await execAsync(`git -C ${pushDir} show --stat-count=10 HEAD`);
5252
};
5353

54-
const push = async (pushDir: string, name: string, context: Context) => {
55-
signale.info('Pushing to %s@%s', getRepository(context), name);
54+
const push = async (pushDir: string, branch: string, context: Context) => {
55+
signale.info('Pushing to %s@%s', getRepository(context), branch);
5656

5757
const url = getGitUrl(context);
58-
await execAsync(`git -C ${pushDir} push --quiet "${url}" "${name}":"${name}"`, true);
58+
await execAsync(`git -C ${pushDir} push --quiet "${url}" "${branch}":"${branch}"`, true);
5959
};
6060

6161
const cloneForBuild = async (buildDir: string, context: Context) => {

0 commit comments

Comments
 (0)