Determinstically set up PR branch
This commit is contained in:
+12
-1
@@ -177,7 +177,8 @@ export async function reportProgress({ body }: { body: string }): Promise<
|
||||
// no existing comment - create one
|
||||
const issueNumber = ctx.payload.event.issue_number;
|
||||
if (issueNumber === undefined) {
|
||||
throw new Error("cannot create progress comment: no issue_number found in the payload event");
|
||||
// cannot create comment without issue_number (e.g., workflow_dispatch events)
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const result = await ctx.octokit.rest.issues.createComment({
|
||||
@@ -207,6 +208,16 @@ export const ReportProgressTool = tool({
|
||||
execute: contextualize(async ({ body }) => {
|
||||
const result = await reportProgress({ body });
|
||||
|
||||
if (!result) {
|
||||
// gracefully handle case where no comment can be created
|
||||
// this happens for workflow_dispatch events or when there's no associated issue/PR
|
||||
return {
|
||||
success: false,
|
||||
message:
|
||||
"cannot create progress comment: no issue_number found in the payload event. this may occur for workflow_dispatch events or when there is no associated issue/PR. if you need to comment on a specific issue or PR, use create_issue_comment with an explicit issueNumber.",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
...result,
|
||||
|
||||
Reference in New Issue
Block a user