Avoid requesting PR in the create_pull_request_review when not necessary (#91)
This commit is contained in:
committed by
pullfrog[bot]
parent
97dce099c1
commit
d022d02e71
+5
-5
@@ -137763,11 +137763,6 @@ function CreatePullRequestReviewTool(ctx) {
|
||||
parameters: CreatePullRequestReview,
|
||||
execute: execute(async ({ pull_number, body, commit_id, comments = [] }) => {
|
||||
ctx.toolState.prNumber = pull_number;
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
pull_number
|
||||
});
|
||||
const params = {
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
@@ -137778,6 +137773,11 @@ function CreatePullRequestReviewTool(ctx) {
|
||||
if (commit_id) {
|
||||
params.commit_id = commit_id;
|
||||
} else {
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
pull_number
|
||||
});
|
||||
params.commit_id = pr.data.head.sha;
|
||||
}
|
||||
if (comments.length > 0) {
|
||||
|
||||
@@ -137763,11 +137763,6 @@ function CreatePullRequestReviewTool(ctx) {
|
||||
parameters: CreatePullRequestReview,
|
||||
execute: execute(async ({ pull_number, body, commit_id, comments = [] }) => {
|
||||
ctx.toolState.prNumber = pull_number;
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
pull_number
|
||||
});
|
||||
const params = {
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
@@ -137778,6 +137773,11 @@ function CreatePullRequestReviewTool(ctx) {
|
||||
if (commit_id) {
|
||||
params.commit_id = commit_id;
|
||||
} else {
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
pull_number
|
||||
});
|
||||
params.commit_id = pr.data.head.sha;
|
||||
}
|
||||
if (comments.length > 0) {
|
||||
|
||||
+6
-7
@@ -55,13 +55,6 @@ export function CreatePullRequestReviewTool(ctx: ToolContext) {
|
||||
// set PR context
|
||||
ctx.toolState.prNumber = pull_number;
|
||||
|
||||
// get the PR to determine the head commit if commit_id not provided
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
pull_number,
|
||||
});
|
||||
|
||||
// compose the request
|
||||
const params: RestEndpointMethodTypes["pulls"]["createReview"]["parameters"] = {
|
||||
owner: ctx.owner,
|
||||
@@ -73,6 +66,12 @@ export function CreatePullRequestReviewTool(ctx: ToolContext) {
|
||||
if (commit_id) {
|
||||
params.commit_id = commit_id;
|
||||
} else {
|
||||
// get the PR to determine the head commit if commit_id not provided
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
pull_number,
|
||||
});
|
||||
params.commit_id = pr.data.head.sha;
|
||||
}
|
||||
if (comments.length > 0) {
|
||||
|
||||
@@ -137763,11 +137763,6 @@ function CreatePullRequestReviewTool(ctx) {
|
||||
parameters: CreatePullRequestReview,
|
||||
execute: execute(async ({ pull_number, body, commit_id, comments = [] }) => {
|
||||
ctx.toolState.prNumber = pull_number;
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
pull_number
|
||||
});
|
||||
const params = {
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
@@ -137778,6 +137773,11 @@ function CreatePullRequestReviewTool(ctx) {
|
||||
if (commit_id) {
|
||||
params.commit_id = commit_id;
|
||||
} else {
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
owner: ctx.owner,
|
||||
repo: ctx.name,
|
||||
pull_number
|
||||
});
|
||||
params.commit_id = pr.data.head.sha;
|
||||
}
|
||||
if (comments.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user