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
@@ -143167,8 +143167,8 @@ function CreatePullRequestTool(ctx) {
|
||||
base: params.base,
|
||||
draft: params.draft ?? false
|
||||
});
|
||||
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({
|
||||
@@ -143543,10 +143543,7 @@ function extractFromFilePatches(hunks, startLine, endLine, side) {
|
||||
}
|
||||
var 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 \u{1F44D} to at least one comment"
|
||||
).optional()
|
||||
review_id: type.number.describe("The review ID to get comments for")
|
||||
});
|
||||
function hasThumbsUpFrom(comment, username) {
|
||||
if (!comment.reactionGroups) return false;
|
||||
@@ -143720,16 +143717,17 @@ async function getReviewData(input) {
|
||||
function GetReviewCommentsTool(ctx) {
|
||||
return tool({
|
||||
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 \u{1F44D} to at least one comment. Returns a TOC and commentsPath pointing to a markdown file with full comment details.",
|
||||
description: "Get review comments for a pull request review with full thread context. 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) => {
|
||||
const approvedBy = ctx.payload.event.trigger === "fix_review" && ctx.payload.event.approved_only ? ctx.payload.triggerer : void 0;
|
||||
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) {
|
||||
return {
|
||||
@@ -143739,7 +143737,7 @@ function GetReviewCommentsTool(ctx) {
|
||||
threadCount: 0,
|
||||
commentsPath: null,
|
||||
toc: null,
|
||||
instructions: params.approved_by ? `no threads with \u{1F44D} from ${params.approved_by}` : "no threads found for this review"
|
||||
instructions: approvedBy ? `no threads with \u{1F44D} from ${approvedBy}` : "no threads found for this review"
|
||||
};
|
||||
}
|
||||
const { threadBlocks, reviewer, formatted } = result;
|
||||
@@ -147323,7 +147321,7 @@ var JsonPayload = type({
|
||||
version: "string",
|
||||
"agent?": AgentName.or("undefined"),
|
||||
prompt: "string",
|
||||
"triggeringUser?": "string | undefined",
|
||||
"triggerer?": "string | undefined",
|
||||
"eventInstructions?": "string",
|
||||
"repoInstructions?": "string",
|
||||
"event?": "object",
|
||||
@@ -147416,7 +147414,7 @@ function resolvePayload(resolvedPromptInput, repoSettings) {
|
||||
version: jsonPayload?.version ?? package_default.version,
|
||||
agent: resolvedAgent,
|
||||
prompt,
|
||||
triggeringUser: jsonPayload?.triggeringUser ?? // it's not a common use case but GITHUB_ACTOR can be a user when the workflow is manually triggered by a user through GitHub Actions UI
|
||||
triggerer: jsonPayload?.triggerer ?? // it's not a common use case but GITHUB_ACTOR can be a user when the workflow is manually triggered by a user through GitHub Actions UI
|
||||
(!isPullfrog(process.env.GITHUB_ACTOR) ? process.env.GITHUB_ACTOR : void 0),
|
||||
eventInstructions: jsonPayload?.eventInstructions,
|
||||
repoInstructions: jsonPayload?.repoInstructions,
|
||||
|
||||
+3
-3
@@ -229,8 +229,8 @@ interface FixReviewEvent extends BasePayloadEvent {
|
||||
issue_number: number;
|
||||
is_pr: true;
|
||||
review_id: number;
|
||||
/** username of the person who triggered this action - use with get_review_comments approved_by */
|
||||
triggerer: string;
|
||||
/** when true, only address comments the triggerer approved with 👍 (vs all comments) */
|
||||
approved_only?: boolean | undefined;
|
||||
}
|
||||
|
||||
interface ImplementPlanEvent extends BasePayloadEvent {
|
||||
@@ -273,7 +273,7 @@ export interface WriteablePayload {
|
||||
/** the user's actual request (body if @pullfrog tagged) */
|
||||
prompt: string;
|
||||
/** github username of the human who triggered this workflow run */
|
||||
triggeringUser?: string | undefined;
|
||||
triggerer?: string | undefined;
|
||||
/** event-level instructions for this trigger type (flag-expanded server-side) */
|
||||
eventInstructions?: string | undefined;
|
||||
/** repo-level instructions (flag-expanded server-side) */
|
||||
|
||||
@@ -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",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -41382,7 +41382,7 @@ var JsonPayload = type({
|
||||
version: "string",
|
||||
"agent?": AgentName.or("undefined"),
|
||||
prompt: "string",
|
||||
"triggeringUser?": "string | undefined",
|
||||
"triggerer?": "string | undefined",
|
||||
"eventInstructions?": "string",
|
||||
"repoInstructions?": "string",
|
||||
"event?": "object",
|
||||
|
||||
+4
-3
@@ -19,7 +19,8 @@ export const JsonPayload = type({
|
||||
version: "string",
|
||||
"agent?": AgentName.or("undefined"),
|
||||
prompt: "string",
|
||||
"triggeringUser?": "string | undefined",
|
||||
"triggerer?": "string | undefined",
|
||||
|
||||
"eventInstructions?": "string",
|
||||
"repoInstructions?": "string",
|
||||
"event?": "object",
|
||||
@@ -167,8 +168,8 @@ export function resolvePayload(
|
||||
version: jsonPayload?.version ?? packageJson.version,
|
||||
agent: resolvedAgent,
|
||||
prompt,
|
||||
triggeringUser:
|
||||
jsonPayload?.triggeringUser ??
|
||||
triggerer:
|
||||
jsonPayload?.triggerer ??
|
||||
// it's not a common use case but GITHUB_ACTOR can be a user when the workflow is manually triggered by a user through GitHub Actions UI
|
||||
(!isPullfrog(process.env.GITHUB_ACTOR) ? process.env.GITHUB_ACTOR : undefined),
|
||||
eventInstructions: jsonPayload?.eventInstructions,
|
||||
|
||||
Reference in New Issue
Block a user