mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
commit
3c9b0fc6f2
13 changed files with 717 additions and 580 deletions
10
.github/workflows/verify-on-container-alpine.yml
vendored
10
.github/workflows/verify-on-container-alpine.yml
vendored
|
@ -13,7 +13,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -43,7 +42,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -73,7 +71,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -105,7 +102,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -141,7 +137,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -173,7 +168,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -209,7 +203,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -241,7 +234,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -278,7 +270,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -310,7 +301,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
|
10
.github/workflows/verify-on-container-centos.yml
vendored
10
.github/workflows/verify-on-container-centos.yml
vendored
|
@ -13,7 +13,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -42,7 +41,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -71,7 +69,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -102,7 +99,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -137,7 +133,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -168,7 +163,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -203,7 +197,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -234,7 +227,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -270,7 +262,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -301,7 +292,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
|
10
.github/workflows/verify-on-container-ubuntu.yml
vendored
10
.github/workflows/verify-on-container-ubuntu.yml
vendored
|
@ -13,7 +13,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -44,7 +43,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -75,7 +73,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -108,7 +105,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -145,7 +141,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -178,7 +173,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -215,7 +209,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -248,7 +241,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -286,7 +278,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
@ -319,7 +310,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
container:
|
||||
|
|
4
.github/workflows/verify-on-macos.yml
vendored
4
.github/workflows/verify-on-macos.yml
vendored
|
@ -245,9 +245,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
- macos-10.15
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
uses: actions/checkout@v2
|
||||
|
|
11
.github/workflows/verify-on-ubuntu.yml
vendored
11
.github/workflows/verify-on-ubuntu.yml
vendored
|
@ -13,7 +13,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -35,7 +34,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -57,7 +55,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -79,7 +76,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -108,7 +104,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -136,7 +131,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -160,7 +154,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -188,7 +181,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -212,7 +204,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -241,7 +232,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
@ -265,7 +255,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
steps:
|
||||
|
|
15
.github/workflows/verify-on-windows.yml
vendored
15
.github/workflows/verify-on-windows.yml
vendored
|
@ -13,6 +13,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -33,6 +34,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -53,6 +55,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -73,6 +76,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -100,6 +104,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -126,6 +131,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -148,6 +154,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -174,6 +181,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -196,6 +204,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -223,6 +232,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
|
@ -245,9 +255,8 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-16.04
|
||||
- ubuntu-18.04
|
||||
- ubuntu-20.04
|
||||
- windows-2016
|
||||
- windows-2019
|
||||
steps:
|
||||
- name: Checkout source codes
|
||||
uses: actions/checkout@v2
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
MD007: # ul-indent
|
||||
indent: 4
|
||||
MD013: # line-length
|
||||
line_length: 255
|
||||
line_length: 1024
|
||||
MD024: # no-duplicate-heading
|
||||
siblings_only: true
|
||||
MD026: false # no-trailing-punctuation
|
||||
|
|
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
|
||||
## [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
|
||||
|
||||
### Added
|
||||
|
@ -146,7 +157,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
|
||||
* 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.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
|
||||
|
|
|
@ -17,7 +17,7 @@ Useful for SCP, SFTP, and `rsync` over SSH in deployment script.
|
|||
|
||||
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 (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`
|
||||
|
|
336
lib/index.js
336
lib/index.js
|
@ -1,4 +1,3 @@
|
|||
module.exports =
|
||||
/******/ (() => { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
@ -7,14 +6,27 @@ module.exports =
|
|||
/***/ (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.issue = exports.issueCommand = void 0;
|
||||
const os = __importStar(__nccwpck_require__(87));
|
||||
const utils_1 = __nccwpck_require__(278);
|
||||
/**
|
||||
|
@ -92,6 +104,25 @@ function escapeProperty(s) {
|
|||
/***/ (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) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
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());
|
||||
});
|
||||
};
|
||||
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 }));
|
||||
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 file_command_1 = __nccwpck_require__(717);
|
||||
const utils_1 = __nccwpck_require__(278);
|
||||
|
@ -175,7 +200,9 @@ function addPath(inputPath) {
|
|||
}
|
||||
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 options optional. See InputOptions.
|
||||
|
@ -186,9 +213,49 @@ function getInput(name, options) {
|
|||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
if (options && options.trimWhitespace === false) {
|
||||
return val;
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
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.
|
||||
*
|
||||
|
@ -197,6 +264,7 @@ exports.getInput = getInput;
|
|||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setOutput(name, value) {
|
||||
process.stdout.write(os.EOL);
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
|
@ -337,14 +405,27 @@ exports.getState = getState;
|
|||
|
||||
|
||||
// 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) {
|
||||
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;
|
||||
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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.issueCommand = void 0;
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(__nccwpck_require__(747));
|
||||
|
@ -374,6 +455,7 @@ exports.issueCommand = issueCommand;
|
|||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.toCommandValue = void 0;
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
|
@ -392,61 +474,143 @@ exports.toCommandValue = toCommandValue;
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 399:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
/***/ 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
|
||||
/******/ 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
|
||||
*/
|
||||
function main() {
|
||||
try {
|
||||
// parameters
|
||||
const key = core.getInput("key", {
|
||||
const key = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("key", {
|
||||
required: true,
|
||||
});
|
||||
const name = core.getInput("name");
|
||||
const knownHosts = core.getInput("known_hosts", {
|
||||
const name = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("name");
|
||||
const knownHosts = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("known_hosts", {
|
||||
required: true,
|
||||
});
|
||||
const config = core.getInput("config");
|
||||
const ifKeyExists = core.getInput("if_key_exists");
|
||||
const config = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("config");
|
||||
const ifKeyExists = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("if_key_exists");
|
||||
// create ".ssh" directory
|
||||
const home = getHomeDirectory();
|
||||
const dirName = path_1.default.resolve(home, ".ssh");
|
||||
fs_1.default.mkdirSync(dirName, {
|
||||
const dirName = path__WEBPACK_IMPORTED_MODULE_1___default().resolve(home, ".ssh");
|
||||
fs__WEBPACK_IMPORTED_MODULE_0___default().mkdirSync(dirName, {
|
||||
recursive: true,
|
||||
mode: 0o700,
|
||||
});
|
||||
// files to be created
|
||||
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({
|
||||
name: name,
|
||||
contents: insertLf(key, false, true),
|
||||
|
@ -478,13 +642,13 @@ function main() {
|
|||
}
|
||||
// create files
|
||||
for (const file of files) {
|
||||
const fileName = path_1.default.join(dirName, file.name);
|
||||
fs_1.default.writeFileSync(fileName, file.contents, file.options);
|
||||
const fileName = path__WEBPACK_IMPORTED_MODULE_1___default().join(dirName, file.name);
|
||||
fs__WEBPACK_IMPORTED_MODULE_0___default().writeFileSync(fileName, file.contents, file.options);
|
||||
}
|
||||
console.log(`SSH key has been stored to ${dirName} successfully.`);
|
||||
}
|
||||
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
|
||||
*/
|
||||
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
|
||||
return true;
|
||||
}
|
||||
switch (ifKeyExists) {
|
||||
case "replace":
|
||||
// remove file and should create if replace
|
||||
fs_1.default.unlinkSync(keyFilePath);
|
||||
fs__WEBPACK_IMPORTED_MODULE_0___default().unlinkSync(keyFilePath);
|
||||
return true;
|
||||
case "ignore":
|
||||
// should NOT create if ignore
|
||||
|
@ -562,68 +726,8 @@ function shouldCreateKeyFile(keyFilePath, ifKeyExists) {
|
|||
}
|
||||
main();
|
||||
|
||||
})();
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 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);
|
||||
module.exports = __webpack_exports__;
|
||||
/******/ })()
|
||||
;
|
862
package-lock.json
generated
862
package-lock.json
generated
File diff suppressed because it is too large
Load diff
20
package.json
20
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "install-ssh-key",
|
||||
"version": "2.3.0",
|
||||
"version": "2.3.1",
|
||||
"private": true,
|
||||
"description": "Install SSH key in .ssh",
|
||||
"main": "lib/index.js",
|
||||
|
@ -31,16 +31,16 @@
|
|||
"author": "shimataro",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@actions/core": "1.2.6",
|
||||
"@types/node": "14.14.35",
|
||||
"@typescript-eslint/eslint-plugin": "4.18.0",
|
||||
"@typescript-eslint/parser": "4.18.0",
|
||||
"@vercel/ncc": "0.27.0",
|
||||
"eslint": "7.22.0",
|
||||
"markdownlint-cli": "0.27.1",
|
||||
"npm-check-updates": "11.3.0",
|
||||
"@actions/core": "1.4.0",
|
||||
"@types/node": "16.4.10",
|
||||
"@typescript-eslint/eslint-plugin": "4.28.5",
|
||||
"@typescript-eslint/parser": "4.28.5",
|
||||
"@vercel/ncc": "0.29.0",
|
||||
"eslint": "7.32.0",
|
||||
"markdownlint-cli": "0.28.1",
|
||||
"npm-check-updates": "11.8.3",
|
||||
"npm-run-all": "4.1.5",
|
||||
"typescript": "4.2.3",
|
||||
"typescript": "4.3.5",
|
||||
"yaml-lint": "1.2.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue