Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(integrations): publish complete GitHub task creation data

Tinb62c486f6f65
diff --git a/apps/api/src/plugins/github/webhooks/issue-opened.ts b/apps/api/src/plugins/github/webhooks/issue-opened.ts
index 07f4c1a5d..9051982bf 100644
--- a/apps/api/src/plugins/github/webhooks/issue-opened.ts
+++ b/apps/api/src/plugins/github/webhooks/issue-opened.ts
@@ -131,7 +131,16 @@ export async function handleIssueOpened(payload: IssueOpenedPayload) {
return task;
});
if (!createdTask) continue;
- await publishEvent("task.created", { projectId, taskId: createdTask.id });
+ await publishEvent("task.created", {
+ ...createdTask,
+ taskId: createdTask.id,
+ userId: createdTask.userId ?? "",
+ type: "task",
+ content: null,
+ source: "github",
+ externalId: issue.number.toString(),
+ actor: issue.user?.login ?? "github-webhook",
+ });
const project = await db.query.projectTable.findFirst({
where: eq(projectTable.id, projectId),
diff --git a/tests/api-integration/github-import-bounds.test.ts b/tests/api-integration/github-import-bounds.test.ts
index 5af1751cf..c05e9941d 100644
--- a/tests/api-integration/github-import-bounds.test.ts
+++ b/tests/api-integration/github-import-bounds.test.ts
@@ -648,7 +648,18 @@ describe("bounded resumable GitHub import", () => {
const { project } = await setup();
mocks.publish.mockImplementation(async (name, payload) => {
expect(name).toBe("task.created");
- expect(payload.projectId).toBe(project.id);
+ expect(payload).toMatchObject({
+ projectId: project.id,
+ title: "Live issue",
+ description: "Description",
+ priority: "low",
+ status: "to-do",
+ number: 1,
+ userId: "",
+ source: "github",
+ externalId: "77",
+ actor: "github-webhook",
+ });
const task = await db.query.taskTable.findFirst({
where: eq(schema.taskTable.id, payload.taskId!),
});