git: Allow for setting the target branch

This commit is contained in:
Oliver Davies 2020-05-27 10:53:33 +01:00
parent 979aa4a1fc
commit a1c3231a48

View file

@ -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);
}