File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ protected function configure(): void
69
69
protected function execute (InputInterface $ input , OutputInterface $ output ): int
70
70
{
71
71
if ($ this ->shouldHooksBeSkipped ()) {
72
- $ output ->writeLn ('all hooks were skipped because of the environment variable CAPTAINHOOK_SKIP_HOOKS ' );
72
+ $ output ->writeLn ('all hooks were skipped because of the environment variable CAPTAINHOOK_SKIP_HOOKS or CI ' );
73
73
return 0 ;
74
74
}
75
75
@@ -134,9 +134,21 @@ private function handleError(OutputInterface $output, Exception $e): int
134
134
return 1 ;
135
135
}
136
136
137
+ /**
138
+ * Indicates if hooks should be skipped
139
+ *
140
+ * Either because of CI environment or the SKIP environment variable is set.
141
+ *
142
+ * @return bool
143
+ */
137
144
private function shouldHooksBeSkipped (): bool
138
145
{
139
- $ skip = $ _SERVER ['CAPTAINHOOK_SKIP_HOOKS ' ] ?? 0 ;
140
- return (int ) $ skip === 1 ;
146
+ foreach (['CAPTAINHOOK_SKIP_HOOKS ' , 'CI ' ] as $ envVar ) {
147
+ $ skip = (int ) ($ _SERVER [$ envVar ] ?? 0 );
148
+ if ($ skip === 1 ) {
149
+ return true ;
150
+ }
151
+ }
152
+ return false ;
141
153
}
142
154
}
You can’t perform that action at this time.
0 commit comments