Add set_output tool (#205)
This commit is contained in:
committed by
pullfrog[bot]
parent
2daab6fc78
commit
c1f8247077
@@ -19763,7 +19763,7 @@ var require_core = __commonJS({
|
||||
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||
}
|
||||
exports.getBooleanInput = getBooleanInput;
|
||||
function setOutput(name, value2) {
|
||||
function setOutput2(name, value2) {
|
||||
const filePath = process.env["GITHUB_OUTPUT"] || "";
|
||||
if (filePath) {
|
||||
return (0, file_command_1.issueFileCommand)("OUTPUT", (0, file_command_1.prepareKeyValueMessage)(name, value2));
|
||||
@@ -19771,7 +19771,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||
process.stdout.write(os2.EOL);
|
||||
(0, command_1.issueCommand)("set-output", { name }, (0, utils_1.toCommandValue)(value2));
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
exports.setOutput = setOutput2;
|
||||
function setCommandEcho(enabled) {
|
||||
(0, command_1.issue)("echo", enabled ? "on" : "off");
|
||||
}
|
||||
@@ -142448,6 +142448,22 @@ function AddLabelsTool(ctx) {
|
||||
});
|
||||
}
|
||||
|
||||
// mcp/output.ts
|
||||
var SetOutputParams = type({
|
||||
value: type.string.describe("the output value to expose as a GitHub Action output")
|
||||
});
|
||||
function SetOutputTool(ctx) {
|
||||
return tool({
|
||||
name: "set_output",
|
||||
description: "Set the action output for consumption by subsequent workflow steps. The value will be available as the 'result' output of the action.",
|
||||
parameters: SetOutputParams,
|
||||
execute: execute(async (params) => {
|
||||
ctx.toolState.output = params.value;
|
||||
return { success: true };
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// mcp/pr.ts
|
||||
var PullRequest = type({
|
||||
title: type.string.describe("the title of the pull request"),
|
||||
@@ -143218,7 +143234,8 @@ async function startMcpHttpServer(ctx) {
|
||||
CreateBranchTool(ctx),
|
||||
CommitFilesTool(ctx),
|
||||
PushBranchTool(ctx),
|
||||
UploadFileTool(ctx)
|
||||
UploadFileTool(ctx),
|
||||
SetOutputTool(ctx)
|
||||
];
|
||||
if (ctx.payload.bash === "restricted") {
|
||||
tools.push(BashTool(ctx));
|
||||
@@ -162114,6 +162131,12 @@ function getShellInstructions(bash) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function getStandaloneModeInstructions(trigger) {
|
||||
if (trigger !== "unknown") {
|
||||
return "";
|
||||
}
|
||||
return `**Standalone mode**: You are running as a step in a user-defined CI workflow. When you complete your task, call \`${ghPullfrogMcpName}/set_output\` with the main result of your work (generated content, summary of changes, analysis results, etc.). This makes it available as a GitHub Action output named \`result\` for subsequent workflow steps to consume.`;
|
||||
}
|
||||
function resolveInstructions(ctx) {
|
||||
const eventTitleBody = buildEventTitleBody(ctx.payload.event);
|
||||
const eventMetadata = buildEventMetadata(ctx.payload.event);
|
||||
@@ -162172,6 +162195,8 @@ Tool names may be formatted as \`(server name)/(tool name)\`, for example: \`${g
|
||||
|
||||
${getShellInstructions(ctx.payload.bash)}
|
||||
|
||||
${getStandaloneModeInstructions(ctx.payload.event.trigger)}
|
||||
|
||||
**Command execution**: Never use \`sleep\` to wait for commands to complete. Commands run synchronously - when the bash tool returns, the command has finished.
|
||||
|
||||
**Commenting style**: When posting comments via ${ghPullfrogMcpName}, write as a professional team member would. Your final comments should be polished and actionable\u2014do not include intermediate reasoning like "I'll now look at the code" or "Let me respond to the question."
|
||||
@@ -162411,7 +162436,7 @@ function resolvePayload(repoSettings) {
|
||||
}
|
||||
|
||||
// utils/run.ts
|
||||
async function handleAgentResult(result) {
|
||||
function handleAgentResult(result) {
|
||||
if (!result.success) {
|
||||
return {
|
||||
success: false,
|
||||
@@ -162762,7 +162787,10 @@ async function main() {
|
||||
if (toolState.lastProgressBody) {
|
||||
await writeSummary(toolState.lastProgressBody);
|
||||
}
|
||||
return handleAgentResult(result);
|
||||
return {
|
||||
...handleAgentResult(result),
|
||||
result: toolState.output
|
||||
};
|
||||
} catch (_) {
|
||||
var _error = _, _hasError = true;
|
||||
} finally {
|
||||
@@ -162796,6 +162824,9 @@ async function run() {
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || "Agent execution failed");
|
||||
}
|
||||
if (result.result) {
|
||||
core5.setOutput("result", result.result);
|
||||
}
|
||||
} catch (error50) {
|
||||
const errorMessage = error50 instanceof Error ? error50.message : "Unknown error occurred";
|
||||
core5.setFailed(`Action failed: ${errorMessage}`);
|
||||
|
||||
Reference in New Issue
Block a user