fix(DNRY): Moving isGitHubActions to the module context (expensive operation), and the condition to updateSummary().
This commit is contained in:
@@ -106431,6 +106431,7 @@ var addTools = (ctx, server, tools) => {
|
||||
|
||||
// mcp/comment.ts
|
||||
var LEAPING_INTO_ACTION_PREFIX = "Leaping into action";
|
||||
var isGitHubActions2 = !!process.env.GITHUB_ACTIONS;
|
||||
async function buildCommentFooter({
|
||||
payload,
|
||||
octokit,
|
||||
@@ -106559,12 +106560,11 @@ function setProgressCommentId(id) {
|
||||
var ReportProgress = type({
|
||||
body: type.string.describe("the progress update content to share")
|
||||
});
|
||||
var updateSummary = (text) => core3.summary.addRaw(text).write({ overwrite: true });
|
||||
var updateSummary = (text) => isGitHubActions2 && core3.summary.addRaw(text).write({ overwrite: true });
|
||||
async function reportProgress(ctx, { body }) {
|
||||
const existingCommentId = getProgressCommentId();
|
||||
const issueNumber = ctx.toolState.prNumber ?? ctx.toolState.issueNumber ?? ctx.payload.event.issue_number;
|
||||
const isPlanMode = ctx.toolState.selectedMode === "Plan";
|
||||
const isGitHubActions2 = !!process.env.GITHUB_ACTIONS;
|
||||
if (existingCommentId) {
|
||||
const customParts = isPlanMode && issueNumber !== void 0 ? [buildImplementPlanLink(ctx.owner, ctx.name, issueNumber, existingCommentId)] : void 0;
|
||||
const bodyWithoutFooter = stripExistingFooter(body);
|
||||
@@ -106581,7 +106581,7 @@ async function reportProgress(ctx, { body }) {
|
||||
body: bodyWithFooter
|
||||
});
|
||||
progressCommentWasUpdated = true;
|
||||
if (isGitHubActions2) await updateSummary(bodyWithFooter);
|
||||
await updateSummary(bodyWithFooter);
|
||||
return {
|
||||
commentId: result2.data.id,
|
||||
url: result2.data.html_url,
|
||||
@@ -106616,7 +106616,7 @@ async function reportProgress(ctx, { body }) {
|
||||
comment_id: result.data.id,
|
||||
body: bodyWithPlanLink
|
||||
});
|
||||
if (isGitHubActions2) await updateSummary(bodyWithPlanLink);
|
||||
await updateSummary(bodyWithPlanLink);
|
||||
return {
|
||||
commentId: updateResult.data.id,
|
||||
url: updateResult.data.html_url,
|
||||
@@ -106624,7 +106624,7 @@ async function reportProgress(ctx, { body }) {
|
||||
action: "created"
|
||||
};
|
||||
}
|
||||
if (isGitHubActions2) await updateSummary(initialBody);
|
||||
await updateSummary(initialBody);
|
||||
return {
|
||||
commentId: result.data.id,
|
||||
url: result.data.html_url,
|
||||
|
||||
Reference in New Issue
Block a user