Add support for pullrequest->labeled event

This commit is contained in:
Gabriel Taylor Russ 2024-02-12 18:57:10 -08:00
parent a9a064dfa1
commit 38e320dd5a
No known key found for this signature in database
GPG key ID: B50569075FAD6F11
3 changed files with 1310 additions and 1308 deletions

2599
dist/index.js vendored

File diff suppressed because it is too large Load diff

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -87,10 +87,9 @@ function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
- Use the given description only for the overall context and only comment the code.
- IMPORTANT: NEVER suggest adding comments to the code.
Review the following code diff in the file "${
file.to
}" and take the pull request title and description into account when writing the response.
Review the following code diff in the file "${file.to
}" and take the pull request title and description into account when writing the response.
Pull request title: ${prDetails.title}
Pull request description:
@ -103,9 +102,9 @@ Git diff to review:
\`\`\`diff
${chunk.content}
${chunk.changes
// @ts-expect-error - ln and ln2 exists where needed
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
.join("\n")}
// @ts-expect-error - ln and ln2 exists where needed
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
.join("\n")}
\`\`\`
`;
}
@ -188,7 +187,9 @@ async function main() {
readFileSync(process.env.GITHUB_EVENT_PATH ?? "", "utf8")
);
if (eventData.action === "opened") {
let actionNames: string[] = ["opened", "labeled", "reopened"]
if (actionNames.includes(eventData.action)) {
diff = await getDiff(
prDetails.owner,
prDetails.repo,