more spaghetti at the wall [2]

This commit is contained in:
Demitrious Kelly 2020-03-25 15:28:33 -07:00
parent 034d210969
commit db3b78d8e7
2 changed files with 25 additions and 2 deletions

17
dist/index.js vendored
View File

@ -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__) {

View File

@ -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 ) {