@@ -21,6 +21,7 @@ import {
21
21
log ,
22
22
repository ,
23
23
secret ,
24
+ status ,
24
25
} from "@atomist/skill" ;
25
26
import { codeLine } from "@atomist/slack-messages" ;
26
27
import * as _ from "lodash" ;
@@ -115,16 +116,17 @@ ${github.formatMarkers(ctx)}`,
115
116
} ** couldn't be checked out
116
117
${ github . formatMarkers ( ctx ) } `,
117
118
) ;
118
- results . push ( {
119
- code : 0 ,
120
- reason : `Pull request [${ pr . repo . owner } /${ pr . repo . name } #${ pr . number } ](${ pr . url } ) rebase failed because branch ${ pr . branchName } couldn't be checked out` ,
121
- } ) ;
119
+ results . push (
120
+ status . success (
121
+ `Pull request [${ pr . repo . owner } /${ pr . repo . name } #${ pr . number } ](${ pr . url } ) rebase failed because branch ${ pr . branchName } couldn't be checked out` ,
122
+ ) ,
123
+ ) ;
122
124
continue ;
123
125
}
124
126
try {
125
127
const args = [ ] ;
126
- if ( ctx . configuration [ 0 ] ?. parameters ?. strategy ) {
127
- args . push ( "-X" , ctx . configuration [ 0 ] . parameters . strategy ) ;
128
+ if ( ctx . configuration ?. parameters ?. strategy ) {
129
+ args . push ( "-X" , ctx . configuration . parameters . strategy ) ;
128
130
}
129
131
await project . exec ( "git" , [
130
132
"rebase" ,
@@ -153,10 +155,11 @@ ${github.formatMarkers(ctx)}`,
153
155
${ conflicts . map ( c => `- ${ codeLine ( c ) } ` ) . join ( "\n" ) }
154
156
${ github . formatMarkers ( ctx ) } `,
155
157
) ;
156
- results . push ( {
157
- code : 0 ,
158
- reason : `Pull request [${ pr . repo . owner } /${ pr . repo . name } #${ pr . number } ](${ pr . url } ) rebase failed because of conflicts` ,
159
- } ) ;
158
+ results . push (
159
+ status . success (
160
+ `Pull request [${ pr . repo . owner } /${ pr . repo . name } #${ pr . number } ](${ pr . url } ) rebase failed because of conflicts` ,
161
+ ) ,
162
+ ) ;
160
163
continue ;
161
164
}
162
165
@@ -179,10 +182,11 @@ ${github.formatMarkers(ctx)}`,
179
182
} ** errored
180
183
${ github . formatMarkers ( ctx ) } `,
181
184
) ;
182
- results . push ( {
183
- code : 0 ,
184
- reason : `Pull request [${ pr . repo . owner } /${ pr . repo . name } #${ pr . number } ](${ pr . url } ) rebase failed because force push errored` ,
185
- } ) ;
185
+ results . push (
186
+ status . success (
187
+ `Pull request [${ pr . repo . owner } /${ pr . repo . name } #${ pr . number } ](${ pr . url } ) rebase failed because force push errored` ,
188
+ ) ,
189
+ ) ;
186
190
continue ;
187
191
}
188
192
@@ -196,17 +200,18 @@ ${github.formatMarkers(ctx)}`,
196
200
) } by @${ push . after . author . login }
197
201
${ github . formatMarkers ( ctx ) } `,
198
202
) ;
199
- results . push ( {
200
- code : 0 ,
201
- reason : `Pull request [${ pr . repo . owner } /${ pr . repo . name } #${
202
- pr . number
203
- } ](${
204
- pr . url
205
- } ) was successfully rebased onto [${ push . after . sha . slice (
206
- 0 ,
207
- 7 ,
208
- ) } ](${ push . after . url } ) by @${ push . after . author . login } `,
209
- } ) ;
203
+ results . push (
204
+ status . success (
205
+ `Pull request [${ pr . repo . owner } /${ pr . repo . name } #${
206
+ pr . number
207
+ } ](${
208
+ pr . url
209
+ } ) was successfully rebased onto [${ push . after . sha . slice (
210
+ 0 ,
211
+ 7 ,
212
+ ) } ](${ push . after . url } ) by @${ push . after . author . login } `,
213
+ ) ,
214
+ ) ;
210
215
}
211
216
}
212
217
@@ -216,11 +221,11 @@ ${github.formatMarkers(ctx)}`,
216
221
reason : results . map ( r => r . reason ) . join ( "\n" ) ,
217
222
} ;
218
223
} else {
219
- return {
220
- visibility : "hidden" ,
221
- code : 0 ,
222
- reason : `No open pull request that needs rebasing against branch ${ push . branch } ` ,
223
- } ;
224
+ return status
225
+ . success (
226
+ `No open pull request that needs rebasing against branch ${ push . branch } ` ,
227
+ )
228
+ . hidden ( ) ;
224
229
}
225
230
} ;
226
231
0 commit comments