@@ -27,22 +27,23 @@ const pullActionChain: ((req: any, action: Action) => Promise<Action>)[] = [
2727 proc . push . checkRepoInAuthorisedList ,
2828] ;
2929
30+ const defaultActionChain : ( ( req : any , action : Action ) => Promise < Action > ) [ ] = [
31+ proc . push . checkRepoInAuthorisedList ,
32+ ] ;
33+
3034let pluginsInserted = false ;
3135
3236export const executeChain = async ( req : any , res : any ) : Promise < Action > => {
3337 let action : Action = { } as Action ;
38+
3439 try {
3540 action = await proc . pre . parseAction ( req ) ;
3641 const actionFns = await getChain ( action ) ;
3742
3843 for ( const fn of actionFns ) {
3944 action = await fn ( req , action ) ;
40- if ( ! action . continue ( ) ) {
41- return action ;
42- }
43-
44- if ( action . allowPush ) {
45- return action ;
45+ if ( ! action . continue ( ) || action . allowPush ) {
46+ break ;
4647 }
4748 }
4849 } catch ( e ) {
@@ -93,9 +94,13 @@ export const getChain = async (
9394 // This is set to true so that we don't re-insert the plugins into the chain
9495 pluginsInserted = true ;
9596 }
96- if ( action . type === 'pull' ) return pullActionChain ;
97- if ( action . type === 'push' ) return pushActionChain ;
98- return [ ] ;
97+ if ( action . type === 'pull' ) {
98+ return pullActionChain ;
99+ } else if ( action . type === 'push' ) {
100+ return pushActionChain ;
101+ } else {
102+ return defaultActionChain ;
103+ }
99104} ;
100105
101106export default {
@@ -114,6 +119,9 @@ export default {
114119 get pullActionChain ( ) {
115120 return pullActionChain ;
116121 } ,
122+ get defaultActionChain ( ) {
123+ return defaultActionChain ;
124+ } ,
117125 executeChain,
118126 getChain,
119127} ;
0 commit comments