Skip to content

Commit 41c4663

Browse files
committed
feat: allow payload parameter to accept both array and object types in GenerateCommentAction
1 parent c1630ac commit 41c4663

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Actions/GenerateCommentAction.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ public function __construct(WebhookService $webhookService, GithubService $githu
2222
/**
2323
* Generate a comment message from the webhook payload
2424
*
25-
* @param array<string, mixed> $payload The GitHub webhook payload
25+
* @param array<string, mixed>|object $payload
2626
* @param bool $validate Whether to validate the payload (default: true)
2727
*
2828
* @return JsonResponse
2929
* @throws Throwable
3030
*/
31-
public function __invoke(array $payload, bool $validate = true): JsonResponse
31+
public function __invoke(array|object $payload, bool $validate = true): JsonResponse
3232
{
3333
try {
34+
$payload = is_object($payload) ? (array) $payload : $payload;
35+
3436
if ($validate) {
3537
$validationResponse = $this->webhookService->validatePayload($payload);
3638
if ($validationResponse !== null) {

0 commit comments

Comments
 (0)