Dont include quick links if review has no comments
This commit is contained in:
committed by
pullfrog[bot]
parent
cb925556e8
commit
93d74a9bea
@@ -119176,9 +119176,13 @@ function CreatePullRequestReviewTool(ctx) {
|
|||||||
throw new Error(`createReview returned invalid data: ${JSON.stringify(result.data)}`);
|
throw new Error(`createReview returned invalid data: ${JSON.stringify(result.data)}`);
|
||||||
}
|
}
|
||||||
const reviewId = result.data.id;
|
const reviewId = result.data.id;
|
||||||
const apiUrl = process.env.API_URL || "https://pullfrog.com";
|
const customParts = [];
|
||||||
const fixAllUrl = `${apiUrl}/trigger/${ctx.repo.owner}/${ctx.repo.name}/${pull_number}?action=fix&review_id=${reviewId}`;
|
if (comments.length > 0) {
|
||||||
const fixApprovedUrl = `${apiUrl}/trigger/${ctx.repo.owner}/${ctx.repo.name}/${pull_number}?action=fix-approved&review_id=${reviewId}`;
|
const apiUrl = process.env.API_URL || "https://pullfrog.com";
|
||||||
|
const fixAllUrl = `${apiUrl}/trigger/${ctx.repo.owner}/${ctx.repo.name}/${pull_number}?action=fix&review_id=${reviewId}`;
|
||||||
|
const fixApprovedUrl = `${apiUrl}/trigger/${ctx.repo.owner}/${ctx.repo.name}/${pull_number}?action=fix-approved&review_id=${reviewId}`;
|
||||||
|
customParts.push(`[Fix all \u2794](${fixAllUrl})`, `[Fix \u{1F44D}s \u2794](${fixApprovedUrl})`);
|
||||||
|
}
|
||||||
const footer = buildPullfrogFooter({
|
const footer = buildPullfrogFooter({
|
||||||
workflowRun: {
|
workflowRun: {
|
||||||
owner: ctx.repo.owner,
|
owner: ctx.repo.owner,
|
||||||
@@ -119186,7 +119190,7 @@ function CreatePullRequestReviewTool(ctx) {
|
|||||||
runId: ctx.runId,
|
runId: ctx.runId,
|
||||||
jobId: ctx.jobId
|
jobId: ctx.jobId
|
||||||
},
|
},
|
||||||
customParts: [`[Fix all \u2794](${fixAllUrl})`, `[Fix \u{1F44D}s \u2794](${fixApprovedUrl})`]
|
customParts
|
||||||
});
|
});
|
||||||
const updatedBody = (body || "") + footer;
|
const updatedBody = (body || "") + footer;
|
||||||
await ctx.octokit.rest.pulls.updateReview({
|
await ctx.octokit.rest.pulls.updateReview({
|
||||||
|
|||||||
+9
-4
@@ -113,9 +113,14 @@ export function CreatePullRequestReviewTool(ctx: ToolContext) {
|
|||||||
const reviewId = result.data.id;
|
const reviewId = result.data.id;
|
||||||
|
|
||||||
// build quick links footer and update the review body
|
// build quick links footer and update the review body
|
||||||
const apiUrl = process.env.API_URL || "https://pullfrog.com";
|
// only include "Fix all" and "Fix 👍s" links if there are actual review comments
|
||||||
const fixAllUrl = `${apiUrl}/trigger/${ctx.repo.owner}/${ctx.repo.name}/${pull_number}?action=fix&review_id=${reviewId}`;
|
const customParts: string[] = [];
|
||||||
const fixApprovedUrl = `${apiUrl}/trigger/${ctx.repo.owner}/${ctx.repo.name}/${pull_number}?action=fix-approved&review_id=${reviewId}`;
|
if (comments.length > 0) {
|
||||||
|
const apiUrl = process.env.API_URL || "https://pullfrog.com";
|
||||||
|
const fixAllUrl = `${apiUrl}/trigger/${ctx.repo.owner}/${ctx.repo.name}/${pull_number}?action=fix&review_id=${reviewId}`;
|
||||||
|
const fixApprovedUrl = `${apiUrl}/trigger/${ctx.repo.owner}/${ctx.repo.name}/${pull_number}?action=fix-approved&review_id=${reviewId}`;
|
||||||
|
customParts.push(`[Fix all ➔](${fixAllUrl})`, `[Fix 👍s ➔](${fixApprovedUrl})`);
|
||||||
|
}
|
||||||
|
|
||||||
const footer = buildPullfrogFooter({
|
const footer = buildPullfrogFooter({
|
||||||
workflowRun: {
|
workflowRun: {
|
||||||
@@ -124,7 +129,7 @@ export function CreatePullRequestReviewTool(ctx: ToolContext) {
|
|||||||
runId: ctx.runId,
|
runId: ctx.runId,
|
||||||
jobId: ctx.jobId,
|
jobId: ctx.jobId,
|
||||||
},
|
},
|
||||||
customParts: [`[Fix all ➔](${fixAllUrl})`, `[Fix 👍s ➔](${fixApprovedUrl})`],
|
customParts,
|
||||||
});
|
});
|
||||||
|
|
||||||
const updatedBody = (body || "") + footer;
|
const updatedBody = (body || "") + footer;
|
||||||
|
|||||||
Reference in New Issue
Block a user