1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00

Merge pull request #190 from shimataro/develop

version 2.3.1
This commit is contained in:
shimataro 2021-08-01 23:19:32 +09:00 committed by GitHub
commit 3c9b0fc6f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 717 additions and 580 deletions

View file

@ -13,7 +13,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -43,7 +42,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -73,7 +71,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -105,7 +102,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -141,7 +137,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -173,7 +168,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -209,7 +203,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -241,7 +234,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -278,7 +270,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -310,7 +301,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:

View file

@ -13,7 +13,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -42,7 +41,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -71,7 +69,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -102,7 +99,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -137,7 +133,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -168,7 +163,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -203,7 +197,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -234,7 +227,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -270,7 +262,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -301,7 +292,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:

View file

@ -13,7 +13,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -44,7 +43,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -75,7 +73,6 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -108,7 +105,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -145,7 +141,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -178,7 +173,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -215,7 +209,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -248,7 +241,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -286,7 +278,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:
@ -319,7 +310,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
container: container:

View file

@ -245,9 +245,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04 - macos-10.15
- ubuntu-18.04
- ubuntu-20.04
steps: steps:
- name: Checkout source codes - name: Checkout source codes
uses: actions/checkout@v2 uses: actions/checkout@v2

View file

@ -13,7 +13,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -35,7 +34,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -57,7 +55,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -79,7 +76,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -108,7 +104,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -136,7 +131,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -160,7 +154,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -188,7 +181,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -212,7 +204,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -241,7 +232,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:
@ -265,7 +255,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04
- ubuntu-18.04 - ubuntu-18.04
- ubuntu-20.04 - ubuntu-20.04
steps: steps:

View file

@ -13,6 +13,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -33,6 +34,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -53,6 +55,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -73,6 +76,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -100,6 +104,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -126,6 +131,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -148,6 +154,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -174,6 +181,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -196,6 +204,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -223,6 +232,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- windows-2016
- windows-2019 - windows-2019
steps: steps:
- name: Checkout source codes - name: Checkout source codes
@ -245,9 +255,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: os:
- ubuntu-16.04 - windows-2016
- ubuntu-18.04 - windows-2019
- ubuntu-20.04
steps: steps:
- name: Checkout source codes - name: Checkout source codes
uses: actions/checkout@v2 uses: actions/checkout@v2

View file

@ -1,7 +1,7 @@
MD007: # ul-indent MD007: # ul-indent
indent: 4 indent: 4
MD013: # line-length MD013: # line-length
line_length: 255 line_length: 1024
MD024: # no-duplicate-heading MD024: # no-duplicate-heading
siblings_only: true siblings_only: true
MD026: false # no-trailing-punctuation MD026: false # no-trailing-punctuation

View file

@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased] ## [Unreleased]
## [2.3.1] - 2021-08-01
### Security
* Fix [CVE-2021-33502](https://github.com/advisories/GHSA-px4h-xg32-q955)
### Others
* add `windows-2016` virtual environment
* [remove `ubuntu-16.04` virtual environment](https://github.blog/changelog/2021-04-29-github-actions-ubuntu-16-04-lts-virtual-environment-will-be-removed-on-september-20-2021/)
## [2.3.0] - 2021-03-21 ## [2.3.0] - 2021-03-21
### Added ### Added
@ -146,7 +157,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* First release. * First release.
[Unreleased]: https://github.com/shimataro/ssh-key-action/compare/v2.3.0...HEAD [Unreleased]: https://github.com/shimataro/ssh-key-action/compare/v2.3.1...HEAD
[2.3.1]: https://github.com/shimataro/ssh-key-action/compare/v2.3.0...v2.3.1
[2.3.0]: https://github.com/shimataro/ssh-key-action/compare/v2.2.0...v2.3.0 [2.3.0]: https://github.com/shimataro/ssh-key-action/compare/v2.2.0...v2.3.0
[2.2.0]: https://github.com/shimataro/ssh-key-action/compare/v2.1.0...v2.2.0 [2.2.0]: https://github.com/shimataro/ssh-key-action/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/shimataro/ssh-key-action/compare/v2.0.3...v2.1.0 [2.1.0]: https://github.com/shimataro/ssh-key-action/compare/v2.0.3...v2.1.0

View file

@ -17,7 +17,7 @@ Useful for SCP, SFTP, and `rsync` over SSH in deployment script.
tested on: tested on:
* [all available virtual machines](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources) (Windows Server 2019, macOS Catalina, and Ubuntu 20.04/18.04/16.04) * [all available virtual machines](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources) (Windows Server 2019/2016, macOS Catalina, and Ubuntu 20.04/18.04)
* [Docker container (Ubuntu)](https://hub.docker.com/_/ubuntu) / requires `openssh-client` package; `apt install -y openssh-client` * [Docker container (Ubuntu)](https://hub.docker.com/_/ubuntu) / requires `openssh-client` package; `apt install -y openssh-client`
* [Docker container (CentOS)](https://hub.docker.com/_/centos) / requires `openssh-clients` package; `yum install -y openssh-clients` * [Docker container (CentOS)](https://hub.docker.com/_/centos) / requires `openssh-clients` package; `yum install -y openssh-clients`
* [Docker container (Alpine Linux)](https://hub.docker.com/_/alpine) / requires `openssh-client` package; `apk add openssh-client` * [Docker container (Alpine Linux)](https://hub.docker.com/_/alpine) / requires `openssh-client` package; `apk add openssh-client`

View file

@ -1,4 +1,3 @@
module.exports =
/******/ (() => { // webpackBootstrap /******/ (() => { // webpackBootstrap
/******/ "use strict"; /******/ "use strict";
/******/ var __webpack_modules__ = ({ /******/ var __webpack_modules__ = ({
@ -7,14 +6,27 @@ module.exports =
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
result["default"] = mod; __setModuleDefault(result, mod);
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.issue = exports.issueCommand = void 0;
const os = __importStar(__nccwpck_require__(87)); const os = __importStar(__nccwpck_require__(87));
const utils_1 = __nccwpck_require__(278); const utils_1 = __nccwpck_require__(278);
/** /**
@ -92,6 +104,25 @@ function escapeProperty(s) {
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -101,14 +132,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
const command_1 = __nccwpck_require__(351); const command_1 = __nccwpck_require__(351);
const file_command_1 = __nccwpck_require__(717); const file_command_1 = __nccwpck_require__(717);
const utils_1 = __nccwpck_require__(278); const utils_1 = __nccwpck_require__(278);
@ -175,7 +200,9 @@ function addPath(inputPath) {
} }
exports.addPath = addPath; exports.addPath = addPath;
/** /**
* Gets the value of an input. The value is also trimmed. * Gets the value of an input.
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
* Returns an empty string if the value is not defined.
* *
* @param name name of the input to get * @param name name of the input to get
* @param options optional. See InputOptions. * @param options optional. See InputOptions.
@ -186,9 +213,49 @@ function getInput(name, options) {
if (options && options.required && !val) { if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`); throw new Error(`Input required and not supplied: ${name}`);
} }
if (options && options.trimWhitespace === false) {
return val;
}
return val.trim(); return val.trim();
} }
exports.getInput = getInput; exports.getInput = getInput;
/**
* Gets the values of an multiline input. Each value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string[]
*
*/
function getMultilineInput(name, options) {
const inputs = getInput(name, options)
.split('\n')
.filter(x => x !== '');
return inputs;
}
exports.getMultilineInput = getMultilineInput;
/**
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
* The return value is also in boolean type.
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns boolean
*/
function getBooleanInput(name, options) {
const trueValue = ['true', 'True', 'TRUE'];
const falseValue = ['false', 'False', 'FALSE'];
const val = getInput(name, options);
if (trueValue.includes(val))
return true;
if (falseValue.includes(val))
return false;
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
}
exports.getBooleanInput = getBooleanInput;
/** /**
* Sets the value of an output. * Sets the value of an output.
* *
@ -197,6 +264,7 @@ exports.getInput = getInput;
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
function setOutput(name, value) { function setOutput(name, value) {
process.stdout.write(os.EOL);
command_1.issueCommand('set-output', { name }, value); command_1.issueCommand('set-output', { name }, value);
} }
exports.setOutput = setOutput; exports.setOutput = setOutput;
@ -337,14 +405,27 @@ exports.getState = getState;
// For internal use, subject to change. // For internal use, subject to change.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
result["default"] = mod; __setModuleDefault(result, mod);
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.issueCommand = void 0;
// We use any as a valid input type // We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
const fs = __importStar(__nccwpck_require__(747)); const fs = __importStar(__nccwpck_require__(747));
@ -374,6 +455,7 @@ exports.issueCommand = issueCommand;
// We use any as a valid input type // We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.toCommandValue = void 0;
/** /**
* Sanitizes an input into a string so it can be passed into issueCommand safely * Sanitizes an input into a string so it can be passed into issueCommand safely
* @param input input to sanitize into a string * @param input input to sanitize into a string
@ -392,61 +474,143 @@ exports.toCommandValue = toCommandValue;
/***/ }), /***/ }),
/***/ 399: /***/ 747:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ ((module) => {
module.exports = require("fs");
/***/ }),
/***/ 87:
/***/ ((module) => {
module.exports = require("os");
/***/ }),
/***/ 622:
/***/ ((module) => {
module.exports = require("path");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __nccwpck_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ var threw = true;
/******/ try {
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
/******/ threw = false;
/******/ } finally {
/******/ if(threw) delete __webpack_module_cache__[moduleId];
/******/ }
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __nccwpck_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __nccwpck_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __nccwpck_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __nccwpck_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__nccwpck_require__.r(__webpack_exports__);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(747);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(622);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(186);
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nccwpck_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_2__);
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const fs_1 = __importDefault(__nccwpck_require__(747));
const path_1 = __importDefault(__nccwpck_require__(622));
const core = __importStar(__nccwpck_require__(186));
/** /**
* main function * main function
*/ */
function main() { function main() {
try { try {
// parameters // parameters
const key = core.getInput("key", { const key = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("key", {
required: true, required: true,
}); });
const name = core.getInput("name"); const name = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("name");
const knownHosts = core.getInput("known_hosts", { const knownHosts = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("known_hosts", {
required: true, required: true,
}); });
const config = core.getInput("config"); const config = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("config");
const ifKeyExists = core.getInput("if_key_exists"); const ifKeyExists = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("if_key_exists");
// create ".ssh" directory // create ".ssh" directory
const home = getHomeDirectory(); const home = getHomeDirectory();
const dirName = path_1.default.resolve(home, ".ssh"); const dirName = path__WEBPACK_IMPORTED_MODULE_1___default().resolve(home, ".ssh");
fs_1.default.mkdirSync(dirName, { fs__WEBPACK_IMPORTED_MODULE_0___default().mkdirSync(dirName, {
recursive: true, recursive: true,
mode: 0o700, mode: 0o700,
}); });
// files to be created // files to be created
const files = []; const files = [];
if (shouldCreateKeyFile(path_1.default.join(dirName, name), ifKeyExists)) { if (shouldCreateKeyFile(path__WEBPACK_IMPORTED_MODULE_1___default().join(dirName, name), ifKeyExists)) {
files.push({ files.push({
name: name, name: name,
contents: insertLf(key, false, true), contents: insertLf(key, false, true),
@ -478,13 +642,13 @@ function main() {
} }
// create files // create files
for (const file of files) { for (const file of files) {
const fileName = path_1.default.join(dirName, file.name); const fileName = path__WEBPACK_IMPORTED_MODULE_1___default().join(dirName, file.name);
fs_1.default.writeFileSync(fileName, file.contents, file.options); fs__WEBPACK_IMPORTED_MODULE_0___default().writeFileSync(fileName, file.contents, file.options);
} }
console.log(`SSH key has been stored to ${dirName} successfully.`); console.log(`SSH key has been stored to ${dirName} successfully.`);
} }
catch (err) { catch (err) {
core.setFailed(err.message); _actions_core__WEBPACK_IMPORTED_MODULE_2__.setFailed(err.message);
} }
} }
/** /**
@ -543,14 +707,14 @@ function insertLf(value, prepend, append) {
* @returns Yes/No * @returns Yes/No
*/ */
function shouldCreateKeyFile(keyFilePath, ifKeyExists) { function shouldCreateKeyFile(keyFilePath, ifKeyExists) {
if (!fs_1.default.existsSync(keyFilePath)) { if (!fs__WEBPACK_IMPORTED_MODULE_0___default().existsSync(keyFilePath)) {
// should create if file does not exist // should create if file does not exist
return true; return true;
} }
switch (ifKeyExists) { switch (ifKeyExists) {
case "replace": case "replace":
// remove file and should create if replace // remove file and should create if replace
fs_1.default.unlinkSync(keyFilePath); fs__WEBPACK_IMPORTED_MODULE_0___default().unlinkSync(keyFilePath);
return true; return true;
case "ignore": case "ignore":
// should NOT create if ignore // should NOT create if ignore
@ -562,68 +726,8 @@ function shouldCreateKeyFile(keyFilePath, ifKeyExists) {
} }
main(); main();
})();
/***/ }), module.exports = __webpack_exports__;
/***/ 747:
/***/ ((module) => {
module.exports = require("fs");;
/***/ }),
/***/ 87:
/***/ ((module) => {
module.exports = require("os");;
/***/ }),
/***/ 622:
/***/ ((module) => {
module.exports = require("path");;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __nccwpck_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ var threw = true;
/******/ try {
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
/******/ threw = false;
/******/ } finally {
/******/ if(threw) delete __webpack_module_cache__[moduleId];
/******/ }
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
/******/ // module exports must be returned from runtime so entry inlining is disabled
/******/ // startup
/******/ // Load entry module and return exports
/******/ return __nccwpck_require__(399);
/******/ })() /******/ })()
; ;

862
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "install-ssh-key", "name": "install-ssh-key",
"version": "2.3.0", "version": "2.3.1",
"private": true, "private": true,
"description": "Install SSH key in .ssh", "description": "Install SSH key in .ssh",
"main": "lib/index.js", "main": "lib/index.js",
@ -31,16 +31,16 @@
"author": "shimataro", "author": "shimataro",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@actions/core": "1.2.6", "@actions/core": "1.4.0",
"@types/node": "14.14.35", "@types/node": "16.4.10",
"@typescript-eslint/eslint-plugin": "4.18.0", "@typescript-eslint/eslint-plugin": "4.28.5",
"@typescript-eslint/parser": "4.18.0", "@typescript-eslint/parser": "4.28.5",
"@vercel/ncc": "0.27.0", "@vercel/ncc": "0.29.0",
"eslint": "7.22.0", "eslint": "7.32.0",
"markdownlint-cli": "0.27.1", "markdownlint-cli": "0.28.1",
"npm-check-updates": "11.3.0", "npm-check-updates": "11.8.3",
"npm-run-all": "4.1.5", "npm-run-all": "4.1.5",
"typescript": "4.2.3", "typescript": "4.3.5",
"yaml-lint": "1.2.4" "yaml-lint": "1.2.4"
} }
} }

View file

@ -2,6 +2,7 @@
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "es6",
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node",
"lib": [ "lib": [
"es6" "es6"
], ],