Skip to content

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.

TypeScript

Use proper 'duplicate' state_reason for issue closures

Boris Cherny4a04589002a1
diff --git a/.github/workflows/log-issue-events.yml b/.github/workflows/log-issue-events.yml
index ae75a66e..dae438fc 100644
--- a/.github/workflows/log-issue-events.yml
+++ b/.github/workflows/log-issue-events.yml
@@ -115,14 +115,10 @@ jobs:
CLOSED_AUTOMATICALLY="true"
fi
- # Check if closed as duplicate by looking for duplicate label or state_reason
+ # Check if closed as duplicate by state_reason
CLOSED_AS_DUPLICATE="false"
- if [ "$STATE_REASON" = "not_planned" ]; then
- # Check if issue has duplicate label
- LABELS=$(echo "$ISSUE_DATA" | jq -r '.labels[] | select(.name | test("duplicate"; "i")) | .name')
- if [ -n "$LABELS" ]; then
- CLOSED_AS_DUPLICATE="true"
- fi
+ if [ "$STATE_REASON" = "duplicate" ]; then
+ CLOSED_AS_DUPLICATE="true"
fi
# Prepare the event payload
diff --git a/scripts/auto-close-duplicates.ts b/scripts/auto-close-duplicates.ts
index 57205815..0cee40a0 100644
--- a/scripts/auto-close-duplicates.ts
+++ b/scripts/auto-close-duplicates.ts
@@ -65,7 +65,7 @@ async function closeIssueAsDuplicate(
'PATCH',
{
state: 'closed',
- state_reason: 'not_planned',
+ state_reason: 'duplicate',
labels: ['duplicate']
}
);