File tree 1 file changed +15
-0
lines changed
examples/example-drush-command/src/Drush/Commands
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 3
3
namespace Example \Drush \Commands ;
4
4
5
5
use Acquia \Drupal \RecommendedSettings \Drush \Commands \MultisiteDrushCommands ;
6
+ use Acquia \Drupal \RecommendedSettings \Drush \Commands \SettingsDrushCommands ;
6
7
use Consolidation \AnnotatedCommand \CommandData ;
7
8
use Consolidation \AnnotatedCommand \Hooks \HookManager ;
8
9
use Drush \Attributes as CLI ;
9
10
use Drush \Commands \DrushCommands ;
11
+ use Robo \ResultData ;
10
12
11
13
/**
12
14
* An example drush command file.
@@ -34,4 +36,17 @@ public function showSuccessMessage(CommandData $commandData): void {
34
36
$ this ->io ()->info ("The settings.php generated successfully for site ` " . $ uri . "`. " );
35
37
}
36
38
39
+ /**
40
+ * Skip settings.php generation if current environment is CI environment.
41
+ */
42
+ #[CLI \Hook(type: HookManager::PRE_COMMAND_HOOK , target: SettingsDrushCommands::SETTINGS_COMMAND )]
43
+ public function validate (): ?ResultData {
44
+ $ isCI = getenv ('CI ' );
45
+ if (!$ isCI ) {
46
+ return NULL ;
47
+ }
48
+ $ this ->io ()->info ("Skip settings.php generation for CI environment. " );
49
+ return new ResultData (ResultData::EXITCODE_OK );
50
+ }
51
+
37
52
}
You can’t perform that action at this time.
0 commit comments