Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions actions/setup/js/close_issue.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions actions/setup/js/close_issue.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand All @@ -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 = [];

Expand All @@ -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 = [];

Expand All @@ -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 => {
Expand All @@ -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 => {
Expand All @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions actions/setup/js/safe_outputs_tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down