git: Allow for setting the target branch
This commit is contained in:
parent
979aa4a1fc
commit
a1c3231a48
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
class ClosesPullRequests
|
class ClosesPullRequests
|
||||||
{
|
{
|
||||||
private $targetBranch = 'master';
|
private $targetBranch;
|
||||||
private $localBranch;
|
private $localBranch;
|
||||||
private $remoteBranch;
|
private $remoteBranch;
|
||||||
|
|
||||||
|
@ -28,6 +28,11 @@ class ClosesPullRequests
|
||||||
{
|
{
|
||||||
$this->localBranch = exec('git rev-parse --abbrev-ref HEAD');
|
$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 = exec('git rev-parse --abbrev-ref --symbolic-full-name @{u}');
|
||||||
$this->remoteBranch = str_replace('origin/', '', $this->remoteBranch);
|
$this->remoteBranch = str_replace('origin/', '', $this->remoteBranch);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue