Skip to content

Commit

Permalink
Merge pull request #42 from boherm/fix/issue-needed-with-issues-linke…
Browse files Browse the repository at this point in the history
…d-to-pr
  • Loading branch information
boherm authored Jun 4, 2024
2 parents 7ed48b7 + 02f79f7 commit 5a6d89e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __invoke(CheckTableDescriptionCommand $command): void
$errors = $this->validator->validate($prDescription);

// If we have some errors, we need to add (or edit) the comment about this errors
if (count($errors) > 0 || $prDescription->isLinkedIssuesNeeded()) {
if (count($errors) > 0 || ($prDescription->isLinkedIssuesNeeded() && !$prDescription->hasLinkedIssues())) {
$this->prRepository->addTableDescriptionErrorsComment($prId, $errors, $prDescription->isLinkedIssuesNeeded());
} else {
$this->prRepository->removeTableDescriptionErrorsComment($prId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public function getIssuesFixed(): array
return array_pop($matches);
}

public function hasLinkedIssues(): bool
{
return !empty($this->getIssuesFixed());
}

/**
* @return string[]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,29 @@ public static function provideTestHandle(): array
true,
['Feature'],
],
[
new PullRequestId(
repositoryOwner: 'PrestaShop',
repositoryName: 'PrestaShop',
pullRequestNumber: 'fake'
),
'
| Branch? | develop
| Description? | Fake description
| Type? | new feature
| Category? | FO
| BC breaks? | no
| Deprecations? | no
| How to test? | Fake how to test
| UI Tests | Fake UI tests
| Fixed issue or discussion? | Fixes #123
',
[],
[],
true,
false,
['develop', 'Feature'],
],
];
}

Expand Down

0 comments on commit 5a6d89e

Please sign in to comment.