fix(DNRY): Extracting the summary writing into updateSummary() helper.
This commit is contained in:
@@ -106559,6 +106559,7 @@ 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 });
|
||||
async function reportProgress(ctx, { body }) {
|
||||
const existingCommentId = getProgressCommentId();
|
||||
const issueNumber = ctx.toolState.prNumber ?? ctx.toolState.issueNumber ?? ctx.payload.event.issue_number;
|
||||
@@ -106580,7 +106581,7 @@ async function reportProgress(ctx, { body }) {
|
||||
body: bodyWithFooter
|
||||
});
|
||||
progressCommentWasUpdated = true;
|
||||
if (isGitHubActions2) await core3.summary.addRaw(bodyWithFooter).write({ overwrite: true });
|
||||
if (isGitHubActions2) await updateSummary(bodyWithFooter);
|
||||
return {
|
||||
commentId: result2.data.id,
|
||||
url: result2.data.html_url,
|
||||
@@ -106615,7 +106616,7 @@ async function reportProgress(ctx, { body }) {
|
||||
comment_id: result.data.id,
|
||||
body: bodyWithPlanLink
|
||||
});
|
||||
if (isGitHubActions2) await core3.summary.addRaw(bodyWithPlanLink).write({ overwrite: true });
|
||||
if (isGitHubActions2) await updateSummary(bodyWithPlanLink);
|
||||
return {
|
||||
commentId: updateResult.data.id,
|
||||
url: updateResult.data.html_url,
|
||||
@@ -106623,7 +106624,7 @@ async function reportProgress(ctx, { body }) {
|
||||
action: "created"
|
||||
};
|
||||
}
|
||||
if (isGitHubActions2) await core3.summary.addRaw(initialBody).write({ overwrite: true });
|
||||
if (isGitHubActions2) await updateSummary(initialBody);
|
||||
return {
|
||||
commentId: result.data.id,
|
||||
url: result.data.html_url,
|
||||
|
||||
+7
-6
@@ -189,6 +189,10 @@ export const ReportProgress = type({
|
||||
body: type.string.describe("the progress update content to share"),
|
||||
});
|
||||
|
||||
|
||||
/** Updates job summary with the given text. */
|
||||
const updateSummary = (text: string) => core.summary.addRaw(text).write({ overwrite: true });
|
||||
|
||||
/**
|
||||
* Standalone function to report progress to GitHub comment.
|
||||
* Can be called directly without going through the MCP tool interface.
|
||||
@@ -236,8 +240,7 @@ export async function reportProgress(
|
||||
|
||||
progressCommentWasUpdated = true;
|
||||
|
||||
// update job summary with the same content as the progress comment
|
||||
if (isGitHubActions) await core.summary.addRaw(bodyWithFooter).write({ overwrite: true });
|
||||
if (isGitHubActions) await updateSummary(bodyWithFooter);
|
||||
|
||||
return {
|
||||
commentId: result.data.id,
|
||||
@@ -286,8 +289,7 @@ export async function reportProgress(
|
||||
body: bodyWithPlanLink,
|
||||
});
|
||||
|
||||
// update job summary with the same content as the progress comment
|
||||
if (isGitHubActions) await core.summary.addRaw(bodyWithPlanLink).write({ overwrite: true });
|
||||
if (isGitHubActions) await updateSummary(bodyWithPlanLink);
|
||||
|
||||
return {
|
||||
commentId: updateResult.data.id,
|
||||
@@ -297,8 +299,7 @@ export async function reportProgress(
|
||||
};
|
||||
}
|
||||
|
||||
// update job summary with the same content as the progress comment
|
||||
if (isGitHubActions) await core.summary.addRaw(initialBody).write({ overwrite: true });
|
||||
if (isGitHubActions) await updateSummary(initialBody);
|
||||
|
||||
return {
|
||||
commentId: result.data.id,
|
||||
|
||||
Reference in New Issue
Block a user