File tree 5 files changed +309
-82
lines changed
5 files changed +309
-82
lines changed Original file line number Diff line number Diff line change @@ -113,18 +113,17 @@ module.exports = () => ({
113
113
} ) ;
114
114
}
115
115
116
- const results = await Promise . all ( [
117
- pipeline . sync ( ) ,
118
- pipeline . addWebhooks ( `${ request . server . info . uri } /v4/webhooks` )
119
- ] ) ;
116
+ const results = await pipeline . sync ( ) ;
117
+
118
+ await pipeline . addWebhooks ( `${ request . server . info . uri } /v4/webhooks` ) ;
120
119
121
120
const location = urlLib . format ( {
122
121
host : request . headers . host ,
123
122
port : request . headers . port ,
124
123
protocol : request . server . info . protocol ,
125
124
pathname : `${ request . path } /${ pipeline . id } `
126
125
} ) ;
127
- const data = await results [ 0 ] . toJson ( ) ;
126
+ const data = await results . toJson ( ) ;
128
127
129
128
return h
130
129
. response ( data )
Original file line number Diff line number Diff line change @@ -135,17 +135,15 @@ module.exports = () => ({
135
135
oldPipeline . name = scmRepo . name ;
136
136
137
137
// update pipeline with new scmRepo and branch
138
- return oldPipeline
139
- . update ( )
140
- . then ( updatedPipeline =>
141
- Promise . all ( [
142
- updatedPipeline . sync ( ) ,
143
- updatedPipeline . addWebhooks (
144
- `${ request . server . info . uri } /v4/webhooks`
145
- )
146
- ] )
147
- )
148
- . then ( results => h . response ( results [ 0 ] . toJson ( ) ) . code ( 200 ) ) ;
138
+ return oldPipeline . update ( ) . then ( async updatedPipeline => {
139
+ await updatedPipeline . addWebhooks (
140
+ `${ request . server . info . uri } /v4/webhooks`
141
+ ) ;
142
+
143
+ const result = await updatedPipeline . sync ( ) ;
144
+
145
+ return h . response ( result . toJson ( ) ) . code ( 200 ) ;
146
+ } ) ;
149
147
} )
150
148
)
151
149
) ;
You can’t perform that action at this time.
0 commit comments