Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Improved branch handling (#57)
Browse files Browse the repository at this point in the history
* Improved branch handling

* Allow to add labels on PR edition too
  • Loading branch information
mickaelandrieu authored Apr 20, 2018
1 parent 535b10d commit cf0d4b3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/AppBundle/EventSubscriber/PullRequestSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static function getSubscribedEvents()
['removePullRequestValidationComment', 255],
['checkForNewTranslations', 252],
['checkForClassicChanges', 252],
['initBranchLabel', 254],
],
];
}
Expand Down
5 changes: 4 additions & 1 deletion src/AppBundle/Issues/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ public function addLabelCriticalLabelIfNeeded(PullRequest $pullRequest)
public function addBranchLabel(PullRequest $pullRequest)
{
$bodyParser = new BodyParser($pullRequest->getBody());
$issueNumber = $pullRequest->getNumber();
$branch = trim($bodyParser->getBranch());

$this->statusApi->addIssueLabel($pullRequest->getNumber(), $bodyParser->getBranch());
$this->statusApi->addIssueLabel($issueNumber, $branch);
$this->log($issueNumber, $branch);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/AppBundle/Issues/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ final class Status

const CURRENT_BRANCH = '1.7.x';

const BRANCH_173 = '1.7.3.x';

const BRANCH_174 = '1.7.4.x';

const BRANCH_175 = '1.7.5.x';

const BRANCH_176 = '1.7.6.x';

const BRANCH_177 = '1.7.7.x';

const BRANCH_178 = '1.7.8.x';

const BRANCH_179 = '1.7.9.x';

const FUTURE_BRANCH = '1.8.x';

const DEVELOP_BRANCH = 'develop';
Expand Down
7 changes: 7 additions & 0 deletions src/AppBundle/Issues/StatusApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ class StatusApi
Status::REPORT_ON_STARTER_THEME => 'report on StarterTheme',
Status::LEGACY_BRANCH => '1.6.1.x',
Status::CURRENT_BRANCH => '1.7.x',
Status::BRANCH_173 => '1.7.x',
Status::BRANCH_174 => '1.7.x',
Status::BRANCH_175 => '1.7.x',
Status::BRANCH_176 => '1.7.x',
Status::BRANCH_177 => '1.7.x',
Status::BRANCH_178 => '1.7.x',
Status::BRANCH_179 => '1.7.x',
Status::FUTURE_BRANCH => '1.8.x',
Status::DEVELOP_BRANCH => 'develop',
];
Expand Down

0 comments on commit cf0d4b3

Please sign in to comment.