@@ -203,6 +203,74 @@ function retryWithActionAndCommand( test )
203
203
204
204
//
205
205
206
+ function retryLocalAction( test )
207
+ {
208
+ const context = this ;
209
+ const a = test .assetFor( false ) ;
210
+ const actionPath = a.abs( '_action/actions/wretry.action/v1' ) ;
211
+ const execPath = `node ${ a.path.nativize( a.abs( actionPath , 'src/Main.js' ) ) }` ;
212
+
213
+ const repoWithWorkflowDir = a.abs( 'test.action' ) ;
214
+ const localActionRepo = 'https://github.com/dmvict/test.action.git' ;
215
+ const testAction = './.github/actions' ;
216
+
217
+ / * - * /
218
+
219
+ a.ready.then( () =>
220
+ {
221
+ test .case = 'enought attempts' ;
222
+ core.exportVariable( `INPUT_ACTION` , testAction ) ;
223
+ core.exportVariable( `INPUT_WITH` , 'value : 0' ) ;
224
+ core.exportVariable( `INPUT_ATTEMPT_LIMIT` , '4' ) ;
225
+ core.exportVariable( `GITHUB_WORKSPACE` , repoWithWorkflowDir ) ;
226
+ return null ;
227
+ }) ;
228
+
229
+ actionSetup() ;
230
+
231
+ a.shellNonThrowing({ currentPath : actionPath , execPath }) ;
232
+ a.ready.then( ( op ) =>
233
+ {
234
+ test .identical( op.exitCode , 0 ) ;
235
+ if( !_.process.insideTestContainer() )
236
+ test .ge( _.strCount( op.output , '::set-env' ) , 3 ) ;
237
+ test .identical( _.strCount( op.output , '::error::Wrong attempt' ) , 3 ) ;
238
+ test .identical( _.strCount( op.output , /::error::undefined. * Attempts exhausted , made 4 attempts/ ) , 0 ) ;
239
+ test .identical( _.strCount( op.output , 'Success' ) , 1 ) ;
240
+ return null ;
241
+ }) ;
242
+
243
+ a.ready.finally( () =>
244
+ {
245
+ delete process.env.GITHUB_WORKSPACE ;
246
+ return null ;
247
+ }) ;
248
+
249
+ / * - * /
250
+
251
+ return a.ready ;
252
+
253
+ / * * /
254
+
255
+ function actionSetup()
256
+ {
257
+ a.ready.then( () =>
258
+ {
259
+ a.fileProvider.filesDelete( a.abs( '.' ) ) ;
260
+ a.fileProvider.dirMake( actionPath ) ;
261
+ a.fileProvider.dirMake( repoWithWorkflowDir ) ;
262
+ return null ;
263
+ }) ;
264
+ a.shell( `git clone ${ a.path.nativize( context.actionDirPath ) } ${ a.path.nativize( actionPath ) }` ) ;
265
+ a.shell( `git clone ${ localActionRepo } ${ a.path.nativize( repoWithWorkflowDir ) }` ) ;
266
+ a.shell({ currentPath : repoWithWorkflowDir , execPath : 'git checkout local_action' }) ;
267
+ a.shell( `node ${ a.path.nativize( a.abs( actionPath , 'src/Pre.js' ) ) }` ) ;
268
+ return a.ready ;
269
+ }
270
+ }
271
+
272
+ //
273
+
206
274
function retryFetchActionWithoutTagOrHash( test )
207
275
{
208
276
const context = this ;
@@ -1946,6 +2014,7 @@ const Proto =
1946
2014
retryWithUnsupportedAction ,
1947
2015
retryWithActionAndCommand ,
1948
2016
2017
+ retryLocalAction ,
1949
2018
retryFetchActionWithoutTagOrHash ,
1950
2019
retryFetchActionWithTag ,
1951
2020
retryFetchActionWithHash ,
0 commit comments