-
Notifications
You must be signed in to change notification settings - Fork 11
feat(content-extractor): add support for pull_request triggers
#89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,12 @@ export function extractFromEvent(context: typeof github.context): ContentInfo { | |
| if (event === 'issues' && context.payload.action === 'opened') { | ||
| content = `${context.payload.issue?.title}\n${context.payload.issue?.body}` | ||
| issueNumber = context.payload.issue?.number ?? null | ||
| } else if ( | ||
| (event === 'pull_request' || event === 'pull_request_target') && | ||
| context.payload.action === 'opened' | ||
| ) { | ||
| content = `${context.payload.pull_request?.title}\n${context.payload.pull_request?.body}` | ||
| issueNumber = context.payload.pull_request?.number ?? null | ||
| } else if ( | ||
| event === 'issue_comment' && | ||
| context.payload.action === 'created' | ||
|
|
@@ -50,6 +56,8 @@ export function shouldProcess(context: typeof github.context): boolean { | |
|
|
||
| return ( | ||
| (event === 'issues' && context.payload.action === 'opened') || | ||
| ((event === 'pull_request' || event === 'pull_request_target') && | ||
| context.payload.action === 'opened') || | ||
|
Comment on lines
56
to
+60
|
||
| (event === 'issue_comment' && context.payload.action === 'created') || | ||
| (event === 'pull_request_review_comment' && | ||
| context.payload.action === 'created') | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this new pull_request/pull_request_target branch, interpolating optional
title/bodyinto a template literal will stringifynull/undefined(e.g.,"...\nnull"), which can pollute moderation input and potentially cause false positives. Consider normalizing with?? ''(and optionally trimming) so missing fields don't become the literal strings "null"/"undefined".