@@ -240,35 +240,39 @@ export async function deploy(action: ActionInterface): Promise<Status> {
240240 action . silent
241241 )
242242 } else {
243+ const ATTEMPT_LIMIT = 3
243244 // Attempt to push our changes, but fetch + rebase if there were
244245 // other changes added in the meantime
245- const ATTEMPT_LIMIT = 3
246246 let attempt = 0
247+
247248 // Keep track of whether the most recent attempt was rejected
248249 let rejected = false
250+
249251 do {
250252 attempt ++
253+
251254 if ( attempt > ATTEMPT_LIMIT ) throw new Error ( `Attempt limit exceeded` )
252255
253256 // Handle rejection for the previous attempt first such that, on
254257 // the final attempt, time is not wasted rebasing it when it will
255258 // not be pushed
256259 if ( rejected ) {
257- info ( `Fetching upstream ${ action . branch } ... ` )
260+ info ( `Fetching upstream ${ action . branch } … ` )
258261 await execute (
259262 `git fetch ${ action . repositoryPath } ${ action . branch } :${ action . branch } ` ,
260263 `${ action . workspace } /${ temporaryDeploymentDirectory } ` ,
261264 action . silent
262265 )
263- info ( `Rebasing this deployment onto ${ action . branch } ... ` )
266+ info ( `Rebasing this deployment onto ${ action . branch } … ` )
264267 await execute (
265268 `git rebase ${ action . branch } ${ temporaryDeploymentBranch } ` ,
266269 `${ action . workspace } /${ temporaryDeploymentDirectory } ` ,
267270 action . silent
268271 )
269272 }
270273
271- info ( `Pushing changes... (attempt ${ attempt } of ${ ATTEMPT_LIMIT } )` )
274+ info ( `Pushing changes… (attempt ${ attempt } of ${ ATTEMPT_LIMIT } )` )
275+
272276 const pushResult = await execute (
273277 `git push --porcelain ${ action . repositoryPath } ${ temporaryDeploymentBranch } :${ action . branch } ` ,
274278 `${ action . workspace } /${ temporaryDeploymentDirectory } ` ,
@@ -277,8 +281,10 @@ export async function deploy(action: ActionInterface): Promise<Status> {
277281 )
278282
279283 rejected =
284+ Boolean ( action . isTest ) ||
280285 pushResult . stdout . includes ( `[rejected]` ) ||
281286 pushResult . stdout . includes ( `[remote rejected]` )
287+
282288 if ( rejected ) info ( 'Updates were rejected' )
283289
284290 // If the push failed for any reason other than being rejected,
0 commit comments