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