From 0c8863c17351da4d7c8aba85c827f251808f090d Mon Sep 17 00:00:00 2001 From: Rimo Date: Wed, 15 Jan 2020 17:55:14 +0800 Subject: [PATCH] Fix args for ossutil config --- dist/index.js | 15 +++++++++------ src/setup-ossutil.ts | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/dist/index.js b/dist/index.js index 989e8cf..af4aee9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4167,20 +4167,23 @@ function run() { yield installer.getOssutil(version); core.info('ossutil is successfully installed'); // config - const endpoint = core.getInput('endpoint'); - const accessKeyId = core.getInput('access-key-id'); - const accessKeySecret = core.getInput('access-key-secret'); + const inputOptions = { required: true }; + const endpoint = core.getInput('endpoint', inputOptions); + const accessKeyId = core.getInput('access-key-id', inputOptions); + const accessKeySecret = core.getInput('access-key-secret', inputOptions); const stsToken = core.getInput('sts-token'); const args = [ + 'config', '--endpoint', endpoint, '--access-key-id', accessKeyId, '--access-key-secret', - accessKeySecret, - '--sts-token', - stsToken + accessKeySecret ]; + if (stsToken) { + args.push('--sts-token', stsToken); + } const exitCode = yield exec.exec('ossutil', args); if (exitCode === 0) { core.info('ossutil config is done'); diff --git a/src/setup-ossutil.ts b/src/setup-ossutil.ts index 24aff6a..c6b0b82 100644 --- a/src/setup-ossutil.ts +++ b/src/setup-ossutil.ts @@ -10,20 +10,23 @@ async function run(): Promise { core.info('ossutil is successfully installed') // config - const endpoint = core.getInput('endpoint') - const accessKeyId = core.getInput('access-key-id') - const accessKeySecret = core.getInput('access-key-secret') + const inputOptions: core.InputOptions = {required: true} + const endpoint = core.getInput('endpoint', inputOptions) + const accessKeyId = core.getInput('access-key-id', inputOptions) + const accessKeySecret = core.getInput('access-key-secret', inputOptions) const stsToken = core.getInput('sts-token') const args = [ + 'config', '--endpoint', endpoint, '--access-key-id', accessKeyId, '--access-key-secret', - accessKeySecret, - '--sts-token', - stsToken + accessKeySecret ] + if (stsToken) { + args.push('--sts-token', stsToken) + } const exitCode = await exec.exec('ossutil', args) if (exitCode === 0) { core.info('ossutil config is done')