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
- 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>
| @@ -51,42 +51,7 @@ | ||
| 51 | 51 | return match ? parseInt(match[1], 10) : null; |
| 52 | 52 | } |
| 53 | 53 | |
| 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 | - } | |
| 60 | 54 | |
| 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 | - | |
| 90 | 55 | async function closeIssueAsDuplicate( |
| 91 | 56 | owner: string, |
| 92 | 57 | repo: string, |
| @@ -100,7 +65,8 @@ | ||
| 100 | 65 | 'PATCH', |
| 101 | 66 | { |
| 102 | 67 | state: 'closed', |
| 103 | - state_reason: 'not_planned' | |
| 68 | + state_reason: 'not_planned', | |
| 69 | + labels: ['duplicate'] | |
| 104 | 70 | } |
| 105 | 71 | ); |
| 106 | 72 | |
| @@ -117,13 +83,6 @@ | ||
| 117 | 83 | } |
| 118 | 84 | ); |
| 119 | 85 | |
| 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 | - }); | |
| 127 | 86 | } |
| 128 | 87 | |
| 129 | 88 | async function autoCloseDuplicates(): Promise<void> { |