Skip to content

Commit b33de57

Browse files
chore: sync actions from gh-aw@v0.74.7 (#109)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 8c8a264 commit b33de57

5 files changed

Lines changed: 34 additions & 25 deletions

File tree

setup/js/add_reaction.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function resolveRestEndpoint(eventName, owner, repo, payload) {
118118
* @returns {boolean}
119119
*/
120120
function isRestReactionEvent(eventName) {
121-
return ["issues", "issue_comment", "pull_request", "pull_request_review_comment"].includes(eventName);
121+
return ["issues", "issue_comment", "pull_request", "pull_request_review", "pull_request_review_comment"].includes(eventName);
122122
}
123123

124124
/**

setup/js/check_command_position.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ async function main() {
5454
return;
5555
}
5656

57+
if ((eventName === "pull_request" && ["ready_for_review", "review_requested"].includes(context.payload?.action ?? "")) || (eventName === "pull_request_review" && context.payload?.action === "submitted")) {
58+
core.info(`Event ${eventName} with action '${context.payload?.action ?? ""}' does not require command position check`);
59+
core.setOutput("command_position_ok", "true");
60+
core.setOutput("matched_command", "");
61+
return;
62+
}
63+
5764
if (eventName === "issues") {
5865
text = context.payload.issue?.body || "";
5966
} else if (eventName === "pull_request") {
@@ -62,6 +69,8 @@ async function main() {
6269
text = context.payload.comment?.body || "";
6370
} else if (eventName === "pull_request_review_comment") {
6471
text = context.payload.comment?.body || "";
72+
} else if (eventName === "pull_request_review") {
73+
text = context.payload.review?.body || "";
6574
} else if (eventName === "discussion") {
6675
text = context.payload.discussion?.body || "";
6776
} else if (eventName === "discussion_comment") {

setup/js/mcp_server_core.cjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,13 @@ async function handleRequest(server, request, defaultHandler) {
623623

624624
const missing = validateRequiredFields(args, tool.inputSchema);
625625
if (missing.length) {
626+
const hasRequiredFields = tool.inputSchema && Array.isArray(tool.inputSchema.required) && tool.inputSchema.required.length > 0;
627+
if (hasRequiredFields && Object.keys(args).length === 0) {
628+
throw {
629+
code: -32602,
630+
message: `Empty arguments are not allowed — this tool is write-once, not a discovery probe. To inspect the schema, use the tools/list MCP method. To signal that no action is needed, call \`noop\` with a \`message\`.`,
631+
};
632+
}
626633
throw {
627634
code: -32602,
628635
message: generateEnhancedErrorMessage(missing, name, tool.inputSchema),
@@ -751,6 +758,15 @@ async function handleMessage(server, req, defaultHandler) {
751758

752759
const missing = validateRequiredFields(args, tool.inputSchema);
753760
if (missing.length) {
761+
const hasRequiredFields = tool.inputSchema && Array.isArray(tool.inputSchema.required) && tool.inputSchema.required.length > 0;
762+
if (hasRequiredFields && Object.keys(args).length === 0) {
763+
server.replyError(
764+
id,
765+
-32602,
766+
`Empty arguments are not allowed — this tool is write-once, not a discovery probe. To inspect the schema, use the tools/list MCP method. To signal that no action is needed, call \`noop\` with a \`message\`.`
767+
);
768+
return;
769+
}
754770
server.replyError(id, -32602, generateEnhancedErrorMessage(missing, name, tool.inputSchema));
755771
return;
756772
}

setup/js/route_slash_command.cjs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/// <reference types="@actions/github-script" />
33

44
const { REACTION_MAP } = require("./add_reaction.cjs");
5-
const { extractWorkflowId } = require("./generate_footer.cjs");
65
// Keep this aligned with the current default stable GitHub REST API version used by workflows.
76
// Update when GitHub advances the recommended version to avoid sunset/deprecation warnings.
87
const GITHUB_API_VERSION = "2022-11-28";
@@ -272,27 +271,12 @@ async function main() {
272271
return;
273272
}
274273

275-
if ((context.eventName === "pull_request" || context.eventName === "pull_request_review") && Array.isArray(reviewerRoutes) && reviewerRoutes.length > 0) {
274+
if (context.eventName === "pull_request" && Array.isArray(reviewerRoutes) && reviewerRoutes.length > 0) {
276275
const matches = reviewerRoutes.filter(route => Array.isArray(route.events) && route.events.includes(context.eventName));
277276
if (matches.length > 0) {
278277
let selected = matches;
279-
if (context.eventName === "pull_request") {
280-
if (!["ready_for_review", "review_requested"].includes(context.payload?.action ?? "")) {
281-
selected = [];
282-
}
283-
} else if (context.eventName === "pull_request_review") {
284-
const action = context.payload?.action ?? "";
285-
if (action !== "submitted") {
286-
selected = [];
287-
} else {
288-
const workflowId = extractWorkflowId(context.payload?.review?.body ?? "");
289-
if (workflowId) {
290-
selected = selected.filter(route => route.workflow === workflowId);
291-
} else {
292-
selected = [];
293-
core.info("No workflow marker found in pull request review body; skipping reviewer dispatch.");
294-
}
295-
}
278+
if (!["ready_for_review", "review_requested"].includes(context.payload?.action ?? "")) {
279+
selected = [];
296280
}
297281
if (selected.length > 0) {
298282
core.info(`Matched reviewer routes on '${context.eventName}': ${selected.map(route => route.workflow).join(", ")}.`);

setup/js/safe_outputs_tools.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[
22
{
33
"name": "create_issue",
4-
"description": "Create a new GitHub issue for tracking bugs, feature requests, or tasks. Use this for actionable work items that need assignment, labeling, and status tracking. This is a write-once declaration for a real intended issue, not a sandbox or probe: do not call it with placeholder titles/bodies or auth experiments. If you are not ready to open the real issue, use noop or report_incomplete instead. For reports, announcements, or status updates that don't require task tracking, use create_discussion instead.",
4+
"description": "WRITE-ONCE: do NOT call this tool with empty or placeholder arguments to probe or discover its schema — required fields (title, body) are listed in this schema; if you are not ready to open the real issue, call `noop` instead. Creates a new GitHub issue for tracking bugs, feature requests, or tasks. Use this for actionable work items that need assignment, labeling, and status tracking. For reports, announcements, or status updates that don't require task tracking, use create_discussion instead.",
55
"inputSchema": {
66
"type": "object",
77
"required": ["title", "body"],
88
"properties": {
99
"title": {
1010
"type": "string",
11-
"description": "Concise issue title summarizing the bug, feature, or task. The title appears as the main heading, so keep it brief and descriptive."
11+
"description": "Concise issue title summarizing the bug, feature, or task. Must be the final intended title — not a placeholder or test value. The title appears as the main heading, so keep it brief and descriptive."
1212
},
1313
"body": {
1414
"type": "string",
15-
"description": "Detailed issue description in Markdown. Do NOT repeat the title as a heading since it already appears as the issue's h1. Include context, reproduction steps, or acceptance criteria as appropriate."
15+
"description": "Detailed issue description in Markdown. Must be the final intended body — not a placeholder or test value. Do NOT repeat the title as a heading since it already appears as the issue's h1. Include context, reproduction steps, or acceptance criteria as appropriate."
1616
},
1717
"labels": {
1818
"type": "array",
@@ -245,14 +245,14 @@
245245
},
246246
{
247247
"name": "add_comment",
248-
"description": "Add a comment to an existing GitHub issue, pull request, or discussion. Use this to provide feedback, answer questions, or add information to an existing conversation. This is a write-once declaration for a real intended comment, not a sandbox or probe: do not call it with placeholder bodies or auth experiments. If you are not ready to post the real comment, use noop or report_incomplete instead. For creating new items, use create_issue, create_discussion, or create_pull_request instead.",
248+
"description": "WRITE-ONCE: do NOT call this tool with empty or placeholder arguments to probe or discover its schema — the required `body` field is listed in this schema; if you are not ready to post a real comment, call `noop` instead. Adds a comment to an existing GitHub issue, pull request, or discussion. Use this to provide feedback, answer questions, or add information to an existing conversation. For creating new items, use create_issue, create_discussion, or create_pull_request instead.",
249249
"inputSchema": {
250250
"type": "object",
251251
"required": ["body"],
252252
"properties": {
253253
"body": {
254254
"type": "string",
255-
"description": "The comment text in Markdown format. This is the 'body' field - do not use 'comment_body' or other variations. Provide helpful, relevant information that adds value to the conversation."
255+
"description": "The comment text in Markdown format. Must be the final intended comment — not a placeholder or test value. This is the 'body' field - do not use 'comment_body' or other variations. Provide helpful, relevant information that adds value to the conversation."
256256
},
257257
"item_number": {
258258
"type": ["number", "string"],

0 commit comments

Comments
 (0)