spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

Consolidate GitHub issue closure events to prevent duplicatesBrowse files
- Remove duplicate Statsig logging from auto-close-duplicates.ts
- GitHub workflow now handles all issue closures uniformly
- Add 'duplicate' label to ensure proper detection by workflow
- Prevents double-logging when script closes issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Boris Cherny authored on Aug 11, 2025 parent 2dbf1e9 · commit 04cace9ec006
1 changed file+2 -43compared with 2dbf1e9
Mscripts/auto-close-duplicates.ts
@@ -51,42 +51,7 @@
5151 return match ? parseInt(match[1], 10) : null;
5252 }
5353
54-async function logStatsigEvent(eventName: string, value: number, metadata: Record<string, any>): Promise<void> {
55- const statsigApiKey = process.env.STATSIG_API_KEY;
56- if (!statsigApiKey) {
57- console.log("[DEBUG] STATSIG_API_KEY not found, skipping Statsig logging");
58- return;
59- }
6054
61- const eventPayload = {
62- events: [{
63- eventName,
64- value,
65- metadata,
66- time: Math.floor(Date.now()).toString()
67- }]
68- };
69-
70- try {
71- const response = await fetch('https://events.statsigapi.net/v1/log_event', {
72- method: 'POST',
73- headers: {
74- 'Content-Type': 'application/json',
75- 'STATSIG-API-KEY': statsigApiKey
76- },
77- body: JSON.stringify(eventPayload)
78- });
79-
80- if (response.ok) {
81- console.log(`[DEBUG] Successfully logged Statsig event: ${eventName}`);
82- } else {
83- console.log(`[DEBUG] Failed to log Statsig event: ${response.status} ${response.statusText}`);
84- }
85- } catch (error) {
86- console.log(`[DEBUG] Error logging to Statsig: ${error}`);
87- }
88-}
89-
9055 async function closeIssueAsDuplicate(
9156 owner: string,
9257 repo: string,
@@ -100,7 +65,8 @@
10065 'PATCH',
10166 {
10267 state: 'closed',
103- state_reason: 'not_planned'
68+ state_reason: 'not_planned',
69+ labels: ['duplicate']
10470 }
10571 );
10672
@@ -117,13 +83,6 @@
11783 }
11884 );
11985
120- // Log to Statsig
121- await logStatsigEvent('github_issue_closed_as_duplicate', 1, {
122- repository: `${owner}/${repo}`,
123- issue_number: issueNumber,
124- duplicate_of_issue: duplicateOfNumber,
125- closed_by: 'auto-close-script'
126- });
12786 }
12887
12988 async function autoCloseDuplicates(): Promise<void> {