git: Add option to force merge and skip CI check

This commit is contained in:
Oliver Davies 2020-05-30 03:46:54 +01:00
parent d258d9db8b
commit 964472bbf5

View file

@ -69,6 +69,11 @@ class ClosesPullRequests
private function confirmCiStatusIsPassing(): void private function confirmCiStatusIsPassing(): void
{ {
if ($this->isForce()) {
echo 'Forced. Skipping ci-status check...' . PHP_EOL;
return;
}
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.
@ -212,6 +217,16 @@ class ClosesPullRequests
return current($values); return current($values);
} }
private function hasArg(string $shortOpts, array $longOpts = []): bool
{
return !empty(getopt($shortOpts, $longOpts));
}
private function isForce(): bool
{
return $this->hasArg('f::', ['force::']);
}
/** /**
* Run the command. * Run the command.
* *