From d94084a84db3c3f64b60e5196813f81ed2ab4177 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 05:17:46 +0000 Subject: [PATCH 1/2] Initial plan From 75ea14717f2354a7428d54f073b0a31b4e8088e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 05:25:41 +0000 Subject: [PATCH 2/2] fix: update close_issue state_reason enum to UPPERCASE constants Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/close_issue.cjs | 6 +++--- actions/setup/js/close_issue.test.cjs | 16 ++++++++-------- actions/setup/js/safe_outputs_tools.json | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions/setup/js/close_issue.cjs b/actions/setup/js/close_issue.cjs index 7704996ba4b..4294858ad0e 100644 --- a/actions/setup/js/close_issue.cjs +++ b/actions/setup/js/close_issue.cjs @@ -59,7 +59,7 @@ async function addIssueComment(github, owner, repo, issueNumber, message) { * @param {string} owner - Repository owner * @param {string} repo - Repository name * @param {number} issueNumber - Issue number - * @param {string} [stateReason] - The reason for closing: "completed", "not_planned", or "duplicate" + * @param {string} [stateReason] - The reason for closing: "COMPLETED", "NOT_PLANNED", or "DUPLICATE" * @returns {Promise<{number: number, html_url: string, title: string}>} Issue details */ async function closeIssue(github, owner, repo, issueNumber, stateReason) { @@ -68,7 +68,7 @@ async function closeIssue(github, owner, repo, issueNumber, stateReason) { repo, issue_number: issueNumber, state: "closed", - state_reason: stateReason || "completed", + state_reason: (stateReason || "COMPLETED").toLowerCase(), }); return issue; @@ -85,7 +85,7 @@ async function main(config = {}) { const requiredTitlePrefix = config.required_title_prefix || ""; const maxCount = config.max || 10; const comment = config.comment || ""; - const configStateReason = config.state_reason || "completed"; + const configStateReason = config.state_reason || "COMPLETED"; const { defaultTargetRepo, allowedRepos } = resolveTargetRepoConfig(config); // Check if we're in staged mode diff --git a/actions/setup/js/close_issue.test.cjs b/actions/setup/js/close_issue.test.cjs index 87e105b8f04..9e56df8dd24 100644 --- a/actions/setup/js/close_issue.test.cjs +++ b/actions/setup/js/close_issue.test.cjs @@ -598,7 +598,7 @@ describe("close_issue", () => { expect(updateCalls[0].repo).toBe("gh-aw"); }); - it("should use default state_reason 'completed' when not specified", async () => { + it("should use default state_reason 'COMPLETED' when not specified", async () => { const handler = await main({ max: 10 }); const updateCalls = []; @@ -619,7 +619,7 @@ describe("close_issue", () => { expect(updateCalls[0].state_reason).toBe("completed"); }); - it("should use item-level state_reason 'duplicate' when specified in message", async () => { + it("should use item-level state_reason 'DUPLICATE' when specified in message", async () => { const handler = await main({ max: 10 }); const updateCalls = []; @@ -634,13 +634,13 @@ describe("close_issue", () => { }; }; - const result = await handler({ issue_number: 100, body: "Duplicate of #50", state_reason: "duplicate" }, {}); + const result = await handler({ issue_number: 100, body: "Duplicate of #50", state_reason: "DUPLICATE" }, {}); expect(result.success).toBe(true); expect(updateCalls[0].state_reason).toBe("duplicate"); }); - it("should use item-level state_reason 'not_planned' when specified in message", async () => { + it("should use item-level state_reason 'NOT_PLANNED' when specified in message", async () => { const handler = await main({ max: 10 }); const updateCalls = []; @@ -655,14 +655,14 @@ describe("close_issue", () => { }; }; - const result = await handler({ issue_number: 100, body: "Won't fix", state_reason: "not_planned" }, {}); + const result = await handler({ issue_number: 100, body: "Won't fix", state_reason: "NOT_PLANNED" }, {}); expect(result.success).toBe(true); expect(updateCalls[0].state_reason).toBe("not_planned"); }); it("should use config-level state_reason as default for all closes", async () => { - const handler = await main({ max: 10, state_reason: "duplicate" }); + const handler = await main({ max: 10, state_reason: "DUPLICATE" }); const updateCalls = []; mockGithub.rest.issues.update = async params => { @@ -683,7 +683,7 @@ describe("close_issue", () => { }); it("should prefer item-level state_reason over config-level default", async () => { - const handler = await main({ max: 10, state_reason: "not_planned" }); + const handler = await main({ max: 10, state_reason: "NOT_PLANNED" }); const updateCalls = []; mockGithub.rest.issues.update = async params => { @@ -697,7 +697,7 @@ describe("close_issue", () => { }; }; - const result = await handler({ issue_number: 100, body: "Duplicate of #50", state_reason: "duplicate" }, {}); + const result = await handler({ issue_number: 100, body: "Duplicate of #50", state_reason: "DUPLICATE" }, {}); expect(result.success).toBe(true); expect(updateCalls[0].state_reason).toBe("duplicate"); diff --git a/actions/setup/js/safe_outputs_tools.json b/actions/setup/js/safe_outputs_tools.json index 56140139ac2..dd122ee3656 100644 --- a/actions/setup/js/safe_outputs_tools.json +++ b/actions/setup/js/safe_outputs_tools.json @@ -135,8 +135,8 @@ }, "state_reason": { "type": "string", - "enum": ["completed", "not_planned", "duplicate"], - "description": "The reason for closing the issue. Use 'completed' for resolved issues, 'not_planned' for issues that won't be addressed, or 'duplicate' for duplicate issues. Defaults to 'completed'." + "enum": ["COMPLETED", "NOT_PLANNED", "DUPLICATE"], + "description": "The reason for closing the issue. Use 'COMPLETED' for resolved issues, 'NOT_PLANNED' for issues that won't be addressed, or 'DUPLICATE' for duplicate issues. Defaults to 'COMPLETED'." } }, "additionalProperties": false