Skip to content

Commit

Permalink
Allow plugins to run for enabled hooks even if no actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed May 2, 2021
1 parent f377662 commit a6ec43d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Runner/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,15 @@ public function run(): void

$actions = $this->getActionsToExecute($hookConfigs);

$this->beforeHook();

// if no actions are configured do nothing
if (count($actions) === 0) {
$this->io->write(['', '<info>No actions to execute</info>'], true, IO::VERBOSE);
return;
} else {
$this->executeActions($actions);
}
$this->beforeHook();
$this->executeActions($actions);

$this->afterHook();
}

Expand Down Expand Up @@ -448,7 +450,7 @@ private function executeRunnerPluginsFor(string $method, ?Config\Action $action
$this->io->write(['', 'Executing plugins for: <comment>' . $method . '</comment>'], true, IO::DEBUG);

foreach ($plugins as $plugin) {
$this->io->write(get_class($plugin), true, IO::DEBUG);
$this->io->write('<info>- Running ' . get_class($plugin) . '::' . $method . '</info>', true, IO::DEBUG);
$plugin->{$method}(...$params);
}
}
Expand Down

0 comments on commit a6ec43d

Please sign in to comment.