@@ -80,12 +80,13 @@ async function uploadPackage(productId, zipPath, token) {
80
80
}
81
81
if ( status === 'Succeeded' ) {
82
82
core . info ( 'Package validated.' ) ;
83
- return ;
83
+ return true ;
84
84
}
85
85
// Validation failed.
86
86
core . setFailed ( 'Validation failed: ' + response . data . errorCode ) ;
87
87
core . setFailed ( response . data . message ) ;
88
88
response . data . errors . forEach ( ( e ) => core . setFailed ( JSON . stringify ( e ) ) ) ;
89
+ return false ;
89
90
}
90
91
async function sendSubmissionRequest ( productId , token ) {
91
92
core . info ( 'Start to send submission request.' ) ;
@@ -102,7 +103,8 @@ async function sendSubmissionRequest(productId, token) {
102
103
let status ;
103
104
while ( true ) {
104
105
response = await ( 0 , axios_1 . default ) ( url , { headers : { Authorization : `Bearer ${ token } ` } } ) ;
105
- status = response . data . Status ;
106
+ status = response . data . status ;
107
+ core . debug ( 'Status: ' + status ) ;
106
108
if ( status !== 'InProgress' ) {
107
109
break ;
108
110
}
@@ -176,7 +178,11 @@ async function sendSubmissionRequest(productId, token) {
176
178
async function run ( productId , zipPath , clientId , clientSecret , accessUrl ) {
177
179
core . info ( 'Start to publish edge addon.' ) ;
178
180
const token = await getAccessToken ( clientId , clientSecret , accessUrl ) ;
179
- await uploadPackage ( productId , zipPath , token ) ;
181
+ const uploaded = await uploadPackage ( productId , zipPath , token ) ;
182
+ if ( ! uploaded ) {
183
+ core . setFailed ( 'Addon not published.' ) ;
184
+ return ;
185
+ }
180
186
await sendSubmissionRequest ( productId , token ) ;
181
187
core . info ( 'Addon published.' ) ;
182
188
}
0 commit comments