diff --git a/bin/git-close-pull-request b/bin/git-close-pull-request index e9dcc7b..03e1d02 100755 --- a/bin/git-close-pull-request +++ b/bin/git-close-pull-request @@ -16,7 +16,7 @@ class ClosesPullRequests { - private $targetBranch = 'master'; + private $targetBranch; private $localBranch; private $remoteBranch; @@ -28,6 +28,11 @@ class ClosesPullRequests { $this->localBranch = exec('git rev-parse --abbrev-ref HEAD'); + $this->targetBranch = getenv('TARGET_BRANCH'); + if (!$this->targetBranch) { + die('No target branch specified. Aborting.'); + } + $this->remoteBranch = exec('git rev-parse --abbrev-ref --symbolic-full-name @{u}'); $this->remoteBranch = str_replace('origin/', '', $this->remoteBranch); }