fix(DNRY): Extracting isGitHubActions flag.

This commit is contained in:
Robin Tail
2026-01-12 10:18:08 +01:00
parent 074a860a95
commit 48108b137a
2 changed files with 8 additions and 18 deletions
+4 -9
View File
@@ -106563,6 +106563,7 @@ 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;
const isPlanMode = ctx.toolState.selectedMode === "Plan"; const isPlanMode = ctx.toolState.selectedMode === "Plan";
const isGitHubActions2 = !!process.env.GITHUB_ACTIONS;
if (existingCommentId) { if (existingCommentId) {
const customParts = isPlanMode && issueNumber !== void 0 ? [buildImplementPlanLink(ctx.owner, ctx.name, issueNumber, existingCommentId)] : void 0; const customParts = isPlanMode && issueNumber !== void 0 ? [buildImplementPlanLink(ctx.owner, ctx.name, issueNumber, existingCommentId)] : void 0;
const bodyWithoutFooter = stripExistingFooter(body); const bodyWithoutFooter = stripExistingFooter(body);
@@ -106579,9 +106580,7 @@ async function reportProgress(ctx, { body }) {
body: bodyWithFooter body: bodyWithFooter
}); });
progressCommentWasUpdated = true; progressCommentWasUpdated = true;
if (process.env.GITHUB_ACTIONS) { if (isGitHubActions2) await core3.summary.addRaw(bodyWithFooter).write({ overwrite: true });
await core3.summary.addRaw(bodyWithFooter).write({ overwrite: true });
}
return { return {
commentId: result2.data.id, commentId: result2.data.id,
url: result2.data.html_url, url: result2.data.html_url,
@@ -106616,9 +106615,7 @@ async function reportProgress(ctx, { body }) {
comment_id: result.data.id, comment_id: result.data.id,
body: bodyWithPlanLink body: bodyWithPlanLink
}); });
if (process.env.GITHUB_ACTIONS) { if (isGitHubActions2) await core3.summary.addRaw(bodyWithPlanLink).write({ overwrite: true });
await core3.summary.addRaw(bodyWithPlanLink).write({ overwrite: true });
}
return { return {
commentId: updateResult.data.id, commentId: updateResult.data.id,
url: updateResult.data.html_url, url: updateResult.data.html_url,
@@ -106626,9 +106623,7 @@ async function reportProgress(ctx, { body }) {
action: "created" action: "created"
}; };
} }
if (process.env.GITHUB_ACTIONS) { if (isGitHubActions2) await core3.summary.addRaw(initialBody).write({ overwrite: true });
await core3.summary.addRaw(initialBody).write({ overwrite: true });
}
return { return {
commentId: result.data.id, commentId: result.data.id,
url: result.data.html_url, url: result.data.html_url,
+4 -9
View File
@@ -210,6 +210,7 @@ export async function reportProgress(
const issueNumber = const issueNumber =
ctx.toolState.prNumber ?? ctx.toolState.issueNumber ?? ctx.payload.event.issue_number; ctx.toolState.prNumber ?? ctx.toolState.issueNumber ?? ctx.payload.event.issue_number;
const isPlanMode = ctx.toolState.selectedMode === "Plan"; const isPlanMode = ctx.toolState.selectedMode === "Plan";
const isGitHubActions = !!process.env.GITHUB_ACTIONS;
// if we already have a progress comment, update it // if we already have a progress comment, update it
if (existingCommentId) { if (existingCommentId) {
@@ -236,9 +237,7 @@ export async function reportProgress(
progressCommentWasUpdated = true; progressCommentWasUpdated = true;
// update job summary with the same content as the progress comment // update job summary with the same content as the progress comment
if (process.env.GITHUB_ACTIONS) { if (isGitHubActions) await core.summary.addRaw(bodyWithFooter).write({ overwrite: true });
await core.summary.addRaw(bodyWithFooter).write({ overwrite: true });
}
return { return {
commentId: result.data.id, commentId: result.data.id,
@@ -288,9 +287,7 @@ export async function reportProgress(
}); });
// update job summary with the same content as the progress comment // update job summary with the same content as the progress comment
if (process.env.GITHUB_ACTIONS) { if (isGitHubActions) await core.summary.addRaw(bodyWithPlanLink).write({ overwrite: true });
await core.summary.addRaw(bodyWithPlanLink).write({ overwrite: true });
}
return { return {
commentId: updateResult.data.id, commentId: updateResult.data.id,
@@ -301,9 +298,7 @@ export async function reportProgress(
} }
// update job summary with the same content as the progress comment // update job summary with the same content as the progress comment
if (process.env.GITHUB_ACTIONS) { if (isGitHubActions) await core.summary.addRaw(initialBody).write({ overwrite: true });
await core.summary.addRaw(initialBody).write({ overwrite: true });
}
return { return {
commentId: result.data.id, commentId: result.data.id,