generated from ubiquity-os/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adds serialized comment object and payload to the schema
- Loading branch information
1 parent
1549feb
commit 71854b4
Showing
11 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
plugins: | ||
- name: test-app | ||
id: test-app | ||
uses: | ||
- plugin: https://ubiquity-os-comment-vector-embeddings.sshivaditya.workers.dev | ||
runsOn: [ "issue_comment.created", "issue_comment.edited", "issue_comment.deleted" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { EmitterWebhookEvent as WebhookEvent } from "@octokit/webhooks"; | ||
import { Type } from "@sinclair/typebox"; | ||
|
||
const commentObjectSchema = Type.Object({ | ||
action: Type.String(), | ||
issue: Type.Object({ | ||
id: Type.Number(), | ||
number: Type.Number(), | ||
title: Type.String(), | ||
body: Type.String(), | ||
user: Type.Object({ | ||
login: Type.String(), | ||
id: Type.Number(), | ||
}), | ||
}), | ||
comment: Type.Object({ | ||
author_association: Type.String(), | ||
id: Type.Number(), | ||
html_url: Type.String(), | ||
issue_url: Type.String(), | ||
user: Type.Object({ | ||
login: Type.String(), | ||
id: Type.Number(), | ||
}), | ||
}), | ||
}); | ||
|
||
/** | ||
* Cleans the comment object. | ||
* | ||
* @param commentObject - The comment object. | ||
* @returns The cleaned comment object. | ||
*/ | ||
export const cleanCommentObject = (commentObject: WebhookEvent["payload"]): JSON => { | ||
// Apply the schema to the comment object | ||
return commentObjectSchema.parse(commentObject); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE issue_comments | ||
ADD COLUMN commentobject jsonb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters