From 964472bbf57e0a9054e70f3f2ac5c2c5c2f0e546 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 30 May 2020 03:46:54 +0100 Subject: [PATCH] git: Add option to force merge and skip CI check --- bin/git-close-pull-request | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/git-close-pull-request b/bin/git-close-pull-request index ee663e3..811a045 100755 --- a/bin/git-close-pull-request +++ b/bin/git-close-pull-request @@ -69,6 +69,11 @@ class ClosesPullRequests 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; // TODO: Check for failures, or skip if there is no CI. @@ -212,6 +217,16 @@ class ClosesPullRequests 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. *