Merge pull request #23 from pullfrog/pullfrog/17-report-progress-job-summary
feat(mcp): Update job summary with progress comment content
This commit is contained in:
@@ -49152,7 +49152,7 @@ var require_core4 = __commonJS({
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var id_1 = require_id2();
|
||||
var ref_1 = require_ref2();
|
||||
var core4 = [
|
||||
var core5 = [
|
||||
"$schema",
|
||||
"$id",
|
||||
"$defs",
|
||||
@@ -49162,7 +49162,7 @@ var require_core4 = __commonJS({
|
||||
id_1.default,
|
||||
ref_1.default
|
||||
];
|
||||
exports.default = core4;
|
||||
exports.default = core5;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -74359,7 +74359,7 @@ var init_index_CLFto6T2 = __esm({
|
||||
});
|
||||
|
||||
// entry.ts
|
||||
var core3 = __toESM(require_core(), 1);
|
||||
var core4 = __toESM(require_core(), 1);
|
||||
|
||||
// node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/arrays.js
|
||||
var append = (to, value2, opts) => {
|
||||
@@ -91320,13 +91320,13 @@ async function summaryTable(rows, options) {
|
||||
})
|
||||
);
|
||||
if (isGitHubActions) {
|
||||
const summary2 = core.summary;
|
||||
const summary3 = core.summary;
|
||||
if (title) {
|
||||
summary2.addRaw(`**${title}**
|
||||
summary3.addRaw(`**${title}**
|
||||
|
||||
`);
|
||||
}
|
||||
summary2.addTable(formattedRows);
|
||||
summary3.addTable(formattedRows);
|
||||
}
|
||||
if (title) {
|
||||
core.info(`
|
||||
@@ -106202,6 +106202,9 @@ import { mkdtemp as mkdtemp2 } from "node:fs/promises";
|
||||
import { tmpdir as tmpdir2 } from "node:os";
|
||||
import { join as join13 } from "node:path";
|
||||
|
||||
// mcp/comment.ts
|
||||
var core3 = __toESM(require_core(), 1);
|
||||
|
||||
// utils/api.ts
|
||||
var DEFAULT_REPO_SETTINGS = {
|
||||
defaultAgent: null,
|
||||
@@ -106429,6 +106432,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,
|
||||
@@ -106557,6 +106561,7 @@ function setProgressCommentId(id) {
|
||||
var ReportProgress = type({
|
||||
body: type.string.describe("the progress update content to share")
|
||||
});
|
||||
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;
|
||||
@@ -106577,6 +106582,7 @@ async function reportProgress(ctx, { body }) {
|
||||
body: bodyWithFooter
|
||||
});
|
||||
progressCommentWasUpdated = true;
|
||||
await updateSummary(bodyWithFooter);
|
||||
return {
|
||||
commentId: result2.data.id,
|
||||
url: result2.data.html_url,
|
||||
@@ -106611,6 +106617,7 @@ async function reportProgress(ctx, { body }) {
|
||||
comment_id: result.data.id,
|
||||
body: bodyWithPlanLink
|
||||
});
|
||||
await updateSummary(bodyWithPlanLink);
|
||||
return {
|
||||
commentId: updateResult.data.id,
|
||||
url: updateResult.data.html_url,
|
||||
@@ -106618,6 +106625,7 @@ async function reportProgress(ctx, { body }) {
|
||||
action: "created"
|
||||
};
|
||||
}
|
||||
await updateSummary(initialBody);
|
||||
return {
|
||||
commentId: result.data.id,
|
||||
url: result.data.html_url,
|
||||
@@ -131977,7 +131985,7 @@ var require_core5 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const id_1 = require_id3();
|
||||
const ref_1 = require_ref3();
|
||||
const core4 = [
|
||||
const core5 = [
|
||||
"$schema",
|
||||
"$id",
|
||||
"$defs",
|
||||
@@ -131987,7 +131995,7 @@ var require_core5 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
||||
id_1.default,
|
||||
ref_1.default
|
||||
];
|
||||
exports.default = core4;
|
||||
exports.default = core5;
|
||||
}));
|
||||
var require_limitNumber3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
@@ -138650,10 +138658,10 @@ async function run() {
|
||||
}
|
||||
try {
|
||||
const inputs = {
|
||||
prompt: core3.getInput("prompt", { required: true }),
|
||||
prompt: core4.getInput("prompt", { required: true }),
|
||||
...flatMorph(
|
||||
agents,
|
||||
(_, agent2) => agent2.apiKeyNames.map((inputKey) => [inputKey, core3.getInput(inputKey)])
|
||||
(_, agent2) => agent2.apiKeyNames.map((inputKey) => [inputKey, core4.getInput(inputKey)])
|
||||
)
|
||||
};
|
||||
const result = await main(inputs);
|
||||
@@ -138662,7 +138670,7 @@ async function run() {
|
||||
}
|
||||
} catch (error50) {
|
||||
const errorMessage = error50 instanceof Error ? error50.message : "Unknown error occurred";
|
||||
core3.setFailed(`Action failed: ${errorMessage}`);
|
||||
core4.setFailed(`Action failed: ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
await run();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as core from "@actions/core";
|
||||
import { type } from "arktype";
|
||||
import type { Payload } from "../external.ts";
|
||||
import { agentsManifest } from "../external.ts";
|
||||
@@ -14,6 +15,8 @@ import { execute, tool } from "./shared.ts";
|
||||
*/
|
||||
export const LEAPING_INTO_ACTION_PREFIX = "Leaping into action";
|
||||
|
||||
const isGitHubActions = !!process.env.GITHUB_ACTIONS;
|
||||
|
||||
interface BuildCommentFooterParams {
|
||||
payload: Payload;
|
||||
octokit?: OctokitWithPlugins | undefined;
|
||||
@@ -188,6 +191,10 @@ export const ReportProgress = type({
|
||||
body: type.string.describe("the progress update content to share"),
|
||||
});
|
||||
|
||||
|
||||
/** Updates job summary with the given text if running in GitHub Actions. */
|
||||
const updateSummary = (text: string) => isGitHubActions && 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.
|
||||
@@ -234,6 +241,8 @@ export async function reportProgress(
|
||||
|
||||
progressCommentWasUpdated = true;
|
||||
|
||||
await updateSummary(bodyWithFooter);
|
||||
|
||||
return {
|
||||
commentId: result.data.id,
|
||||
url: result.data.html_url,
|
||||
@@ -281,6 +290,8 @@ export async function reportProgress(
|
||||
body: bodyWithPlanLink,
|
||||
});
|
||||
|
||||
await updateSummary(bodyWithPlanLink);
|
||||
|
||||
return {
|
||||
commentId: updateResult.data.id,
|
||||
url: updateResult.data.html_url,
|
||||
@@ -289,6 +300,8 @@ export async function reportProgress(
|
||||
};
|
||||
}
|
||||
|
||||
await updateSummary(initialBody);
|
||||
|
||||
return {
|
||||
commentId: result.data.id,
|
||||
url: result.data.html_url,
|
||||
|
||||
Reference in New Issue
Block a user