diff --git a/dist/index.js b/dist/index.js index 0ea1a93..ab6bc08 100644 --- a/dist/index.js +++ b/dist/index.js @@ -659,9 +659,13 @@ 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 core = __importStar(__webpack_require__(470)); const exec = __importStar(__webpack_require__(986)); +const fs_1 = __importDefault(__webpack_require__(747)); function run() { return __awaiter(this, void 0, void 0, function* () { const userArguments = getUserArguments(); @@ -669,7 +673,11 @@ function run() { try { yield exec.exec(`mkdir -v -p ${process.env['HOME']}/.ssh`); yield exec.exec(`chmod 700 ${process.env['HOME']}/.ssh`); - yield exec.exec(`echo "${userArguments.knownHosts}" > ${process.env['HOME']}/.ssh/known_hosts`); + fs_1.default.writeFile(process.env['HOME'] + '/.ssh/known_hosts', userArguments.knownHosts, (err) => { + if (err) + throw err; + console.log('Wrote ' + process.env['HOME'] + '/.ssh/known_hosts'); + }); yield exec.exec(`chmod 755 ${process.env['HOME']}/.ssh/known_hosts`); console.log("✅ Configured known_hosts"); } @@ -1016,6 +1024,13 @@ module.exports = require("path"); /***/ }), +/***/ 747: +/***/ (function(module) { + +module.exports = require("fs"); + +/***/ }), + /***/ 986: /***/ (function(__unusedmodule, exports, __webpack_require__) { diff --git a/src/main.ts b/src/main.ts index 4011b72..8262958 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,6 @@ import * as core from '@actions/core'; import * as exec from '@actions/exec'; +import fs from 'fs'; import { IActionArguments } from './types'; async function run() { @@ -8,7 +9,14 @@ async function run() { try { await exec.exec(`mkdir -v -p ${process.env['HOME']}/.ssh`); await exec.exec(`chmod 700 ${process.env['HOME']}/.ssh`); - await exec.exec(`echo "${userArguments.knownHosts}" > ${process.env['HOME']}/.ssh/known_hosts`); + fs.writeFile( + process.env['HOME'] + '/.ssh/known_hosts', + userArguments.knownHosts, + (err) => { + if (err) throw err; + console.log('Wrote ' + process.env['HOME'] + '/.ssh/known_hosts'); + } + ); await exec.exec(`chmod 755 ${process.env['HOME']}/.ssh/known_hosts`); console.log("✅ Configured known_hosts"); } catch( error ) {