Standardize on top-level triggerer property (#361)
* Standardize on top-level `triggerer` property - Rename `triggeringUser` → `triggerer` as the single top-level payload property - Remove redundant `triggerer` from `FixReviewEvent`, add `approvedOnly` boolean - Auto-apply `approved_by` filtering in `get_review_comments` when `approvedOnly` is set - Auto-assign created PRs to the triggerer - Simplify `AddressReviews` mode prompt - Accept both `triggerer` and `triggeringUser` in schema for backward compat * Address review feedback: simplify approved_only, remove addAssignees, drop approved_by param * Fix formatting in `action/mcp/pr.ts` * re-add triggeringUser backward-compat fallback in payload schema * auto-assign created PRs to the triggerer * Revert "auto-assign created PRs to the triggerer" This reverts commit c088c425fea33793eb299a001ffd253798d2c674. * Revert "re-add triggeringUser backward-compat fallback in payload schema" This reverts commit ae5b3cb3f1377cd4a634b2d48962c785c31013f3. * backend compat * tweak prompt to ensure compat * Address review feedback * chore: remove triggeringUser fallback --------- Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com> Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
This commit is contained in:
committed by
pullfrog[bot]
parent
20b08b5321
commit
c456fae716
@@ -78,9 +78,8 @@ export function CreatePullRequestTool(ctx: ToolContext) {
|
||||
});
|
||||
|
||||
// best-effort: request review from the user who triggered the workflow
|
||||
// skip for draft PRs since they're not ready for review
|
||||
const reviewer = ctx.payload.triggeringUser;
|
||||
if (reviewer && !params.draft) {
|
||||
const reviewer = ctx.payload.triggerer;
|
||||
if (reviewer) {
|
||||
try {
|
||||
log.debug(`requesting review from ${reviewer} on PR #${result.data.number}`);
|
||||
await ctx.octokit.rest.pulls.requestReviewers({
|
||||
|
||||
+10
-9
@@ -291,11 +291,6 @@ function extractFromFilePatches(
|
||||
export const GetReviewComments = type({
|
||||
pull_number: type.number.describe("The pull request number"),
|
||||
review_id: type.number.describe("The review ID to get comments for"),
|
||||
approved_by: type.string
|
||||
.describe(
|
||||
"Optional GitHub username - only return threads where this user gave a 👍 to at least one comment"
|
||||
)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
function hasThumbsUpFrom(comment: ReviewThreadComment, username: string): boolean {
|
||||
@@ -545,17 +540,23 @@ export function GetReviewCommentsTool(ctx: ToolContext) {
|
||||
name: "get_review_comments",
|
||||
description:
|
||||
"Get review comments for a pull request review with full thread context. " +
|
||||
"When approved_by is provided, only returns threads where that user gave a 👍 to at least one comment. " +
|
||||
"Automatically filters to approved comments when applicable. " +
|
||||
"Returns a TOC and commentsPath pointing to a markdown file with full comment details.",
|
||||
parameters: GetReviewComments,
|
||||
execute: execute(async (params) => {
|
||||
// auto-filter to approved comments when the event has approved_only set
|
||||
const approvedBy =
|
||||
ctx.payload.event.trigger === "fix_review" && ctx.payload.event.approved_only
|
||||
? ctx.payload.triggerer
|
||||
: undefined;
|
||||
|
||||
const result = await getReviewData({
|
||||
octokit: ctx.octokit,
|
||||
owner: ctx.repo.owner,
|
||||
name: ctx.repo.name,
|
||||
pullNumber: params.pull_number,
|
||||
reviewId: params.review_id,
|
||||
approvedBy: params.approved_by,
|
||||
approvedBy,
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
@@ -566,8 +567,8 @@ export function GetReviewCommentsTool(ctx: ToolContext) {
|
||||
threadCount: 0,
|
||||
commentsPath: null,
|
||||
toc: null,
|
||||
instructions: params.approved_by
|
||||
? `no threads with 👍 from ${params.approved_by}`
|
||||
instructions: approvedBy
|
||||
? `no threads with 👍 from ${approvedBy}`
|
||||
: "no threads found for this review",
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user