/**
* @param Commit $commit
* @return bool If the commit should be skipped by the hook
*/
private function shouldSkip(Commit $commit, GitHookConfig $gitHookConfig)
{
$message = $commit->messageBody();
$isEmergency = preg_match('/^EMERGENCY/', $message) === 1;
if ($isEmergency) {
$to = $gitHookConfig->getEmergencyNotificationEmailAddress();
$subject = $gitHookConfig->getEmergencyNotificationSubject();
$body = $gitHookConfig->getEmergencyNotificationBody();
if (!empty($to) && !empty($subject) && !empty($body)) {
GlobalFunctions::mail($to, $subject, $body);
} else {
$this->logger->error("Invalid mail params. Notification email not sent.");
}
}
return $isEmergency;
}