diff --git a/actions/setup/js/safe_outputs_handlers.cjs b/actions/setup/js/safe_outputs_handlers.cjs index 9b2c00e6f9f..0d02fdaf1e1 100644 --- a/actions/setup/js/safe_outputs_handlers.cjs +++ b/actions/setup/js/safe_outputs_handlers.cjs @@ -53,11 +53,7 @@ function buildIntentErrorResponse(error) { */ function hasUpdatePullRequestFields(args) { const safeArgs = args || {}; - return ( - typeof safeArgs.title === "string" || - typeof safeArgs.body === "string" || - safeArgs.update_branch === true - ); + return typeof safeArgs.title === "string" || typeof safeArgs.body === "string" || safeArgs.update_branch === true; } /** diff --git a/actions/setup/js/safe_outputs_handlers.test.cjs b/actions/setup/js/safe_outputs_handlers.test.cjs index f3a6cde8bd7..5e3fd9ba74d 100644 --- a/actions/setup/js/safe_outputs_handlers.test.cjs +++ b/actions/setup/js/safe_outputs_handlers.test.cjs @@ -1776,36 +1776,24 @@ describe("safe_outputs_handlers", () => { }); it("should throw MCP error when called with null/undefined args", () => { - expect(() => handlers.updatePullRequestHandler(null)).toThrow( - expect.objectContaining({ code: -32602 }) - ); - expect(() => handlers.updatePullRequestHandler(undefined)).toThrow( - expect.objectContaining({ code: -32602 }) - ); + expect(() => handlers.updatePullRequestHandler(null)).toThrow(expect.objectContaining({ code: -32602 })); + expect(() => handlers.updatePullRequestHandler(undefined)).toThrow(expect.objectContaining({ code: -32602 })); }); it("should throw MCP error when update_branch is explicitly false and no other fields", () => { - expect(() => handlers.updatePullRequestHandler({ update_branch: false })).toThrow( - expect.objectContaining({ code: -32602 }) - ); + expect(() => handlers.updatePullRequestHandler({ update_branch: false })).toThrow(expect.objectContaining({ code: -32602 })); }); it("should throw MCP error when title is null", () => { - expect(() => handlers.updatePullRequestHandler({ title: null })).toThrow( - expect.objectContaining({ code: -32602 }) - ); + expect(() => handlers.updatePullRequestHandler({ title: null })).toThrow(expect.objectContaining({ code: -32602 })); }); it("should throw MCP error when body is null", () => { - expect(() => handlers.updatePullRequestHandler({ body: null })).toThrow( - expect.objectContaining({ code: -32602 }) - ); + expect(() => handlers.updatePullRequestHandler({ body: null })).toThrow(expect.objectContaining({ code: -32602 })); }); it("should throw MCP error when update_branch is null", () => { - expect(() => handlers.updatePullRequestHandler({ update_branch: null })).toThrow( - expect.objectContaining({ code: -32602 }) - ); + expect(() => handlers.updatePullRequestHandler({ update_branch: null })).toThrow(expect.objectContaining({ code: -32602 })); }); it("should write entry and return success when title is provided", () => { @@ -1813,9 +1801,7 @@ describe("safe_outputs_handlers", () => { expect(result).toHaveProperty("content"); const data = JSON.parse(result.content[0].text); expect(data.result).toBe("success"); - expect(mockAppendSafeOutput).toHaveBeenCalledWith( - expect.objectContaining({ type: "update_pull_request", title: "New Title" }) - ); + expect(mockAppendSafeOutput).toHaveBeenCalledWith(expect.objectContaining({ type: "update_pull_request", title: "New Title" })); }); it("should write entry and return success when body is provided", () => { @@ -1823,9 +1809,7 @@ describe("safe_outputs_handlers", () => { expect(result).toHaveProperty("content"); const data = JSON.parse(result.content[0].text); expect(data.result).toBe("success"); - expect(mockAppendSafeOutput).toHaveBeenCalledWith( - expect.objectContaining({ type: "update_pull_request", body: "Updated body" }) - ); + expect(mockAppendSafeOutput).toHaveBeenCalledWith(expect.objectContaining({ type: "update_pull_request", body: "Updated body" })); }); it("should write entry and return success when update_branch is true", () => { @@ -1833,9 +1817,7 @@ describe("safe_outputs_handlers", () => { expect(result).toHaveProperty("content"); const data = JSON.parse(result.content[0].text); expect(data.result).toBe("success"); - expect(mockAppendSafeOutput).toHaveBeenCalledWith( - expect.objectContaining({ type: "update_pull_request", update_branch: true }) - ); + expect(mockAppendSafeOutput).toHaveBeenCalledWith(expect.objectContaining({ type: "update_pull_request", update_branch: true })); }); it("should write entry and return success when both title and body are provided", () => { @@ -1843,9 +1825,7 @@ describe("safe_outputs_handlers", () => { expect(result).toHaveProperty("content"); const data = JSON.parse(result.content[0].text); expect(data.result).toBe("success"); - expect(mockAppendSafeOutput).toHaveBeenCalledWith( - expect.objectContaining({ type: "update_pull_request", title: "New Title", body: "New body" }) - ); + expect(mockAppendSafeOutput).toHaveBeenCalledWith(expect.objectContaining({ type: "update_pull_request", title: "New Title", body: "New body" })); }); it("error message should mention all required fields", () => { diff --git a/actions/setup/js/safe_outputs_tools.json b/actions/setup/js/safe_outputs_tools.json index 22f683c65f6..df9aff5ce53 100644 --- a/actions/setup/js/safe_outputs_tools.json +++ b/actions/setup/js/safe_outputs_tools.json @@ -799,7 +799,6 @@ }, { "name": "update_pull_request", - "description": "Update an existing GitHub pull request's title or body. Supports replacing, appending to, or prepending content to the body. Title is always replaced. Only the fields you specify will be updated; other fields remain unchanged. REQUIRED: You must provide at least one of: 'title' (a non-empty string), 'body' (a string), or 'update_branch' set to true (not false). Omitting all three, or passing only 'update_branch: false', will return a -32602 error.", "inputSchema": { "type": "object", @@ -846,14 +845,6 @@ "description": "Trustworthiness level of the message source (e.g., \"low\", \"medium\", \"high\")." } }, - "anyOf": [ - { "required": ["title"] }, - { "required": ["body"] }, - { - "required": ["update_branch"], - "properties": { "update_branch": { "const": true } } - } - ], "additionalProperties": false } },