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); yield installer.getOssutil(version);
core.info('ossutil is successfully installed'); core.info('ossutil is successfully installed');
// config // config
const endpoint = core.getInput('endpoint'); const inputOptions = { required: true };
const accessKeyId = core.getInput('access-key-id'); const endpoint = core.getInput('endpoint', inputOptions);
const accessKeySecret = core.getInput('access-key-secret'); const accessKeyId = core.getInput('access-key-id', inputOptions);
const accessKeySecret = core.getInput('access-key-secret', inputOptions);
const stsToken = core.getInput('sts-token'); const stsToken = core.getInput('sts-token');
const args = [ const args = [
'config',
'--endpoint', '--endpoint',
endpoint, endpoint,
'--access-key-id', '--access-key-id',
accessKeyId, accessKeyId,
'--access-key-secret', '--access-key-secret',
accessKeySecret, accessKeySecret
'--sts-token',
stsToken
]; ];
if (stsToken) {
args.push('--sts-token', stsToken);
}
const exitCode = yield exec.exec('ossutil', args); const exitCode = yield exec.exec('ossutil', args);
if (exitCode === 0) { if (exitCode === 0) {
core.info('ossutil config is done'); core.info('ossutil config is done');

View File

@@ -10,20 +10,23 @@ async function run(): Promise<void> {
core.info('ossutil is successfully installed') core.info('ossutil is successfully installed')
// config // config
const endpoint = core.getInput('endpoint') const inputOptions: core.InputOptions = {required: true}
const accessKeyId = core.getInput('access-key-id') const endpoint = core.getInput('endpoint', inputOptions)
const accessKeySecret = core.getInput('access-key-secret') const accessKeyId = core.getInput('access-key-id', inputOptions)
const accessKeySecret = core.getInput('access-key-secret', inputOptions)
const stsToken = core.getInput('sts-token') const stsToken = core.getInput('sts-token')
const args = [ const args = [
'config',
'--endpoint', '--endpoint',
endpoint, endpoint,
'--access-key-id', '--access-key-id',
accessKeyId, accessKeyId,
'--access-key-secret', '--access-key-secret',
accessKeySecret, accessKeySecret
'--sts-token',
stsToken
] ]
if (stsToken) {
args.push('--sts-token', stsToken)
}
const exitCode = await exec.exec('ossutil', args) const exitCode = await exec.exec('ossutil', args)
if (exitCode === 0) { if (exitCode === 0) {
core.info('ossutil config is done') core.info('ossutil config is done')