git: Refactor to a lookup table

This commit is contained in:
Oliver Davies 2020-05-23 00:05:24 +01:00
parent 89ef98a15b
commit 87d5b689b2

View file

@ -36,9 +36,12 @@ class ClosesPullRequests
echo 'Confirming ci-status on PR is green...' . PHP_EOL; echo 'Confirming ci-status on PR is green...' . PHP_EOL;
// TODO: Check for failures, or skip if there is no CI. // TODO: Check for failures, or skip if there is no CI.
switch (exec('hub ci-status')) { $errors = [
case self::CI_PENDING: self::CI_PENDING => 'Aborting: CI pending',
die('Aborting: CI pending'); ];
if (array_key_exists($status = exec('hub ci-status'), $errors)) {
die($errors[$status]);
} }
} }