@@ -52,59 +52,66 @@ class MicrosoftSecurityDevOps {
52
52
runMain ( ) {
53
53
return __awaiter ( this , void 0 , void 0 , function * ( ) {
54
54
core . debug ( 'MicrosoftSecurityDevOps.runMain - Running MSDO...' ) ;
55
- let args = [ 'run' ] ;
56
- let config = core . getInput ( 'config' ) ;
57
- if ( ! common . isNullOrWhiteSpace ( config ) ) {
58
- args . push ( '-c' ) ;
59
- args . push ( config ) ;
55
+ let args = undefined ;
56
+ let existingFilename = core . getInput ( 'existingFilename' ) ;
57
+ if ( ! common . isNullOrWhiteSpace ( existingFilename ) ) {
58
+ args = [ 'upload' , '--file' , existingFilename ] ;
60
59
}
61
- let policy = core . getInput ( 'policy' ) ;
62
- if ( common . isNullOrWhiteSpace ( policy ) ) {
63
- policy = "GitHub" ;
64
- }
65
- args . push ( '-p' ) ;
66
- args . push ( policy ) ;
67
- let categoriesString = core . getInput ( 'categories' ) ;
68
- if ( ! common . isNullOrWhiteSpace ( categoriesString ) ) {
69
- args . push ( '--categories' ) ;
70
- let categories = categoriesString . split ( ',' ) ;
71
- for ( let i = 0 ; i < categories . length ; i ++ ) {
72
- let category = categories [ i ] ;
73
- if ( ! common . isNullOrWhiteSpace ( category ) ) {
74
- args . push ( category . trim ( ) ) ;
60
+ else {
61
+ args = [ 'run' ] ;
62
+ let config = core . getInput ( 'config' ) ;
63
+ if ( ! common . isNullOrWhiteSpace ( config ) ) {
64
+ args . push ( '-c' ) ;
65
+ args . push ( config ) ;
66
+ }
67
+ let policy = core . getInput ( 'policy' ) ;
68
+ if ( common . isNullOrWhiteSpace ( policy ) ) {
69
+ policy = "GitHub" ;
70
+ }
71
+ args . push ( '-p' ) ;
72
+ args . push ( policy ) ;
73
+ let categoriesString = core . getInput ( 'categories' ) ;
74
+ if ( ! common . isNullOrWhiteSpace ( categoriesString ) ) {
75
+ args . push ( '--categories' ) ;
76
+ let categories = categoriesString . split ( ',' ) ;
77
+ for ( let i = 0 ; i < categories . length ; i ++ ) {
78
+ let category = categories [ i ] ;
79
+ if ( ! common . isNullOrWhiteSpace ( category ) ) {
80
+ args . push ( category . trim ( ) ) ;
81
+ }
75
82
}
76
83
}
77
- }
78
- let languagesString = core . getInput ( 'languages' ) ;
79
- if ( ! common . isNullOrWhiteSpace ( languagesString ) ) {
80
- args . push ( '--languages ') ;
81
- let languages = languagesString . split ( ',' ) ;
82
- for ( let i = 0 ; i < languages . length ; i ++ ) {
83
- let language = languages [ i ] ;
84
- if ( ! common . isNullOrWhiteSpace ( language ) ) {
85
- args . push ( language . trim ( ) ) ;
84
+ let languagesString = core . getInput ( 'languages' ) ;
85
+ if ( ! common . isNullOrWhiteSpace ( languagesString ) ) {
86
+ args . push ( '--languages' ) ;
87
+ let languages = languagesString . split ( ', ') ;
88
+ for ( let i = 0 ; i < languages . length ; i ++ ) {
89
+ let language = languages [ i ] ;
90
+ if ( ! common . isNullOrWhiteSpace ( language ) ) {
91
+ args . push ( language . trim ( ) ) ;
92
+ }
86
93
}
87
94
}
88
- }
89
- let toolsString = core . getInput ( 'tools' ) ;
90
- let includedTools = [ ] ;
91
- if ( ! common . isNullOrWhiteSpace ( toolsString ) ) {
92
- let tools = toolsString . split ( ',' ) ;
93
- for ( let i = 0 ; i < tools . length ; i ++ ) {
94
- let tool = tools [ i ] ;
95
- let toolTrimmed = tool . trim ( ) ;
96
- if ( ! common . isNullOrWhiteSpace ( tool )
97
- && tool != msdo_helpers_1 . Tools . ContainerMapping
98
- && includedTools . indexOf ( toolTrimmed ) == - 1 ) {
99
- if ( includedTools . length == 0 ) {
100
- args . push ( '--tool' ) ;
95
+ let toolsString = core . getInput ( 'tools' ) ;
96
+ let includedTools = [ ] ;
97
+ if ( ! common . isNullOrWhiteSpace ( toolsString ) ) {
98
+ let tools = toolsString . split ( ',' ) ;
99
+ for ( let i = 0 ; i < tools . length ; i ++ ) {
100
+ let tool = tools [ i ] ;
101
+ let toolTrimmed = tool . trim ( ) ;
102
+ if ( ! common . isNullOrWhiteSpace ( tool )
103
+ && tool != msdo_helpers_1 . Tools . ContainerMapping
104
+ && includedTools . indexOf ( toolTrimmed ) == - 1 ) {
105
+ if ( includedTools . length == 0 ) {
106
+ args . push ( '--tool' ) ;
107
+ }
108
+ args . push ( toolTrimmed ) ;
109
+ includedTools . push ( toolTrimmed ) ;
101
110
}
102
- args . push ( toolTrimmed ) ;
103
- includedTools . push ( toolTrimmed ) ;
104
111
}
105
112
}
113
+ args . push ( '--github' ) ;
106
114
}
107
- args . push ( '--github' ) ;
108
115
yield client . run ( args , 'microsoft/security-devops-action' ) ;
109
116
} ) ;
110
117
}
0 commit comments