1616
1717import * as core from '@actions/core' ;
1818import { PredefinedAcl } from '@google-cloud/storage' ;
19- import {
20- errorMessage ,
21- parseGcloudIgnore ,
22- } from '@google-github-actions/actions-utils' ;
19+ import { errorMessage , parseGcloudIgnore } from '@google-github-actions/actions-utils' ;
2320import ignore from 'ignore' ;
2421
2522import { Client } from './client' ;
@@ -29,31 +26,17 @@ async function run(): Promise<void> {
2926 try {
3027 const path = core . getInput ( 'path' , { required : true } ) ;
3128 const destination = core . getInput ( 'destination' , { required : true } ) ;
32- const gzip =
33- core . getInput ( 'gzip' , { required : false } ) === 'false' ? false : true ;
34- const resumable =
35- core . getInput ( 'resumable' , { required : false } ) === 'false'
36- ? false
37- : true ;
38- const predefinedAclInput = core . getInput ( 'predefinedAcl' , {
39- required : false ,
40- } ) ;
41- const parent =
42- core . getInput ( 'parent' , { required : false } ) . toLowerCase ( ) === 'false'
43- ? false
44- : true ;
29+ const gzip = core . getBooleanInput ( 'gzip' ) ;
30+ const resumable = core . getBooleanInput ( 'resumable' ) ;
31+ const parent = core . getBooleanInput ( 'parent' ) ;
4532 const glob = core . getInput ( 'glob' ) ;
4633 const concurrency = Number ( core . getInput ( 'concurrency' ) ) || 100 ;
34+ const predefinedAclInput = core . getInput ( 'predefinedAcl' ) ;
4735 const predefinedAcl =
48- predefinedAclInput === ''
49- ? undefined
50- : ( predefinedAclInput as PredefinedAcl ) ;
51- const headersInput = core . getInput ( 'headers' , {
52- required : false ,
53- } ) ;
36+ predefinedAclInput === '' ? undefined : ( predefinedAclInput as PredefinedAcl ) ;
37+ const headersInput = core . getInput ( 'headers' ) ;
5438 const processGcloudIgnore = core . getBooleanInput ( 'process_gcloudignore' ) ;
55- const metadata =
56- headersInput === '' ? undefined : parseHeadersInput ( headersInput ) ;
39+ const metadata = headersInput === '' ? undefined : parseHeadersInput ( headersInput ) ;
5740 const credentials = core . getInput ( 'credentials' ) ;
5841
5942 // Add warning if using credentials
@@ -87,15 +70,11 @@ async function run(): Promise<void> {
8770
8871 core . setOutput (
8972 'uploaded' ,
90- uploadResponses
91- . map ( ( uploadResponse ) => uploadResponse [ 0 ] . name )
92- . toString ( ) ,
73+ uploadResponses . map ( ( uploadResponse ) => uploadResponse [ 0 ] . name ) . toString ( ) ,
9374 ) ;
9475 } catch ( err ) {
9576 const msg = errorMessage ( err ) ;
96- core . setFailed (
97- `google-github-actions/upload-cloud-storage failed with ${ msg } ` ,
98- ) ;
77+ core . setFailed ( `google-github-actions/upload-cloud-storage failed with: ${ msg } ` ) ;
9978 }
10079}
10180
0 commit comments