@@ -27,22 +27,23 @@ const pullActionChain: ((req: any, action: Action) => Promise<Action>)[] = [
27
27
proc . push . checkRepoInAuthorisedList ,
28
28
] ;
29
29
30
+ const defaultActionChain : ( ( req : any , action : Action ) => Promise < Action > ) [ ] = [
31
+ proc . push . checkRepoInAuthorisedList ,
32
+ ] ;
33
+
30
34
let pluginsInserted = false ;
31
35
32
36
export const executeChain = async ( req : any , res : any ) : Promise < Action > => {
33
37
let action : Action = { } as Action ;
38
+
34
39
try {
35
40
action = await proc . pre . parseAction ( req ) ;
36
41
const actionFns = await getChain ( action ) ;
37
42
38
43
for ( const fn of actionFns ) {
39
44
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 ;
46
47
}
47
48
}
48
49
} catch ( e ) {
@@ -93,9 +94,13 @@ export const getChain = async (
93
94
// This is set to true so that we don't re-insert the plugins into the chain
94
95
pluginsInserted = true ;
95
96
}
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
+ }
99
104
} ;
100
105
101
106
export default {
@@ -114,6 +119,9 @@ export default {
114
119
get pullActionChain ( ) {
115
120
return pullActionChain ;
116
121
} ,
122
+ get defaultActionChain ( ) {
123
+ return defaultActionChain ;
124
+ } ,
117
125
executeChain,
118
126
getChain,
119
127
} ;
0 commit comments