Fix args for ossutil config

This commit is contained in:
Rimo
2020-01-15 17:55:14 +08:00
parent b99d85a130
commit 0c8863c173
2 changed files with 18 additions and 12 deletions

15
dist/index.js vendored
View File

@@ -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');

View File

@@ -10,20 +10,23 @@ async function run(): Promise<void> {
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')