This commit is contained in:
CrazyMax 2019-11-15 16:09:01 +01:00
parent d40e8cac3d
commit 8cdc7f91b1
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 9 additions and 10 deletions

View File

@ -15,14 +15,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const child_process = __importStar(require("child_process"));
const core = __importStar(require("@actions/core"));
const exec = __importStar(require("@actions/exec"));
const ncp_1 = __importDefault(require("ncp"));
const ncp_1 = require("ncp");
const fs = __importStar(require("fs"));
const os = __importStar(require("os"));
const path = __importStar(require("path"));
@ -63,7 +60,7 @@ function run() {
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'github-pages-'));
process.chdir(tmpdir);
core.info(`🏃 Copying ${path.resolve(build_dir)} contents to ${tmpdir}`);
ncp_1.default.ncp(path.resolve(build_dir), tmpdir, err => {
ncp_1.ncp.ncp(path.resolve(build_dir), tmpdir, err => {
if (err !== null) {
core.setFailed(`⛔️ Failed to copy ${path.resolve(build_dir)}`);
}

View File

@ -1,7 +1,7 @@
import * as child_process from 'child_process';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import ncp from 'ncp';
import {ncp} from 'ncp';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
@ -45,11 +45,13 @@ async function run() {
process.chdir(tmpdir);
core.info(`🏃 Copying ${path.resolve(build_dir)} contents to ${tmpdir}`);
ncp.ncp(path.resolve(build_dir), tmpdir, err => {
if (err !== null) {
await new Promise((resolve, reject) => {
ncp.ncp(path.resolve(build_dir), tmpdir, (err) => {
if (err) {
core.setFailed(`⛔️ Failed to copy ${path.resolve(build_dir)}`);
}
});
});
const remote_branch_exists =
child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, {encoding: 'utf8'}).trim().length >