-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.ts
27 lines (22 loc) · 991 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as core from '@actions/core';
import AwsCli from '@aws-github-actions/awscli-core';
import stringArgv from 'string-argv';
const run = async (): Promise<void> => {
try {
// Inputs:
const cliCommand = core.getInput('cli-command', {required: true});
const cliSubcommand = core.getInput('cli-subcommand', {required: true});
const cliOptions = stringArgv(core.getInput('cli-options', {required: false}).trim());
const cliParameters = stringArgv(core.getInput('cli-parameters', {required: false}).trim());
const awsRegion = core.getInput('aws-region', {required: true});
const Aws = await AwsCli.getOrInstall();
// aws [options] <command> <subcommand> [parameters]
const params = [...cliOptions, cliCommand, cliSubcommand, ...cliParameters, '--region', awsRegion];
const result = await Aws.callStdout(params);
core.setOutput('cli-output', result);
} catch (error) {
core.setFailed(error.message);
}
};
run();
export default run;