Skip to content

Commit

Permalink
Enhance PR Description Validation Logic (#605)
Browse files Browse the repository at this point in the history
* Update pullRequests.php

* style: format code with PHP CS Fixer

This commit fixes the style issues introduced in 455d8f9 according to the output
from PHP CS Fixer.

Details: #605

* Update github.php

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
guibranco and deepsource-autofix[bot] authored Oct 8, 2024
1 parent ed8f99c commit 8481283
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Src/lib/github.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function setCheckRunFailed(array $metadata, int $checkRunId, string $type, strin
* of check that was completed. It is used to customize the check run details and message based on the
* specific type of check being performed.
*/
function setCheckRunSucceeded(array $metadata, int $checkRunId, string $type): void
function setCheckRunSucceeded(array $metadata, int $checkRunId, string $type, string $details = null): void
{
$checkRunBody = array(
"name" => "GStraccini Checks: " . ucwords($type),
Expand All @@ -275,7 +275,7 @@ function setCheckRunSucceeded(array $metadata, int $checkRunId, string $type): v
"output" => array(
"title" => "Checks completed ✅",
"summary" => "GStraccini checked this " . strtolower($type) . " successfully!",
"text" => "No issues found."
"text" => $details ?? "No issues found."
)
);

Expand Down
2 changes: 2 additions & 0 deletions Src/pullRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ function checkPullRequestDescription($metadata, $pullRequestUpdated)
$message = $validator->generateReport($validationResult);
setCheckRunFailed($metadata, $checkRunId, $type, $message);
return;
} elseif ($validationResult["found"] === false || $validationResult["found"] === 0) {
setCheckRunSucceeded($metadata, $checkRunId, $type, "No groups or checkboxes found in the PR body.");
}

setCheckRunSucceeded($metadata, $checkRunId, $type);
Expand Down

0 comments on commit 8481283

Please sign in to comment.