Skip to content

Commit 7004f30

Browse files
committed
feat: add queue handling for GitHub comments
1 parent c8a452f commit 7004f30

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

config/github-project.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
],
1414

1515
'enable_status_comment' => env('GITHUB_PROJECT_ENABLE_STATUS_COMMENT', false),
16+
17+
'is_queue_enabled' => env('GITHUB_PROJECT_QUEUE_ENABLED', false),
1618
];

src/Actions/WebhookAction.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ public function __invoke(): JsonResponse
3737

3838
$message = view('github-project::md.comment', compact('payload'))->render();
3939

40-
$this->webhookService->commentOnNode((string) $payload['projects_v2_item']['content_node_id'], $message);
40+
$response = $this->webhookService->handleComment((string) $payload['projects_v2_item']['content_node_id'], $message);
4141

42-
return response()->json(['message' => __('github-project::github-project.success.message')]);
42+
return response()->json([
43+
'message' => __('github-project::github-project.success.message'),
44+
'response' => $response,
45+
]);
4346
}
4447
}

src/Services/WebhookService.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,13 @@ public function commentOnNode(string $contentNodeId, string $message): array
114114

115115
return $this->client->graphql()->execute($query, $variables);
116116
}
117+
118+
public function handleComment(string $contentNodeId, string $message): array
119+
{
120+
if (config('github-project.is_queue_enabled')) {
121+
//
122+
}
123+
124+
return $this->commentOnNode($contentNodeId, $message);
125+
}
117126
}

0 commit comments

Comments
 (0)