Skip to content

Commit

Permalink
Merge pull request #77 from acquia/ISSUE-75
Browse files Browse the repository at this point in the history
ISSUE-75: Added example on skipping settings.php generation.
  • Loading branch information
vishalkhode1 authored Dec 5, 2024
2 parents 2c62bb0 + 41ef47b commit 5c010ff
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
namespace Example\Drush\Commands;

use Acquia\Drupal\RecommendedSettings\Drush\Commands\MultisiteDrushCommands;
use Acquia\Drupal\RecommendedSettings\Drush\Commands\SettingsDrushCommands;
use Consolidation\AnnotatedCommand\CommandData;
use Consolidation\AnnotatedCommand\Hooks\HookManager;
use Drush\Attributes as CLI;
use Drush\Commands\DrushCommands;
use Robo\ResultData;

/**
* An example drush command file.
Expand Down Expand Up @@ -34,4 +36,17 @@ public function showSuccessMessage(CommandData $commandData): void {
$this->io()->info("The settings.php generated successfully for site `" . $uri . "`.");
}

/**
* Skip settings.php generation if current environment is CI environment.
*/
#[CLI\Hook(type: HookManager::PRE_COMMAND_HOOK, target: SettingsDrushCommands::SETTINGS_COMMAND)]
public function validate(): ?ResultData {
$isCI = getenv('CI');
if (!$isCI) {
return NULL;
}
$this->io()->info("Skip settings.php generation for CI environment.");
return new ResultData(ResultData::EXITCODE_OK);
}

}

0 comments on commit 5c010ff

Please sign in to comment.