Files
twenty/scripts/issue-cleanup-labels.sh
T
Claude ea30dbcd99 feat: comprehensive issue management with auto-triage, cleanup, and stale bot
Auto-triage workflow (issue-triage.yml):
- Classifies new issues using Claude Haiku (single turn, low cost)
- Sets GitHub issue types (Bug/Feature/Task) via GraphQL API
- Applies scope, priority, and size labels automatically
- Detects potential duplicates by comparing against open issues
- Guides support questions to Discord/Discussions
- Flags feature suggestions for discussion conversion
- Requests reproduction steps for unconfirmed bugs

Stale issue workflow (issue-stale.yml):
- Marks issues stale after 90 days of inactivity
- Auto-closes after 14 more days
- Exempts critical, high priority, and bounty issues

Issue template updates:
- Remove all "type: *" labels from templates (replaced by issue types)
- Auto-triage handles classification for all templates uniformly

One-time scripts (scripts/):
- issue-cleanup-labels.sh: deletes obsolete type labels and typos
- issue-backfill-triage.sh: triages existing 154 unlabeled issues

https://claude.ai/code/session_012t1J7hF5Th74qF9Fcn8h3h
2026-03-18 09:24:18 +00:00

83 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# One-time script to clean up issue labels.
# Run locally with an authenticated `gh` CLI:
# bash scripts/issue-cleanup-labels.sh
#
# What it does:
# 1. Deletes typo / stale / obsolete labels
# 2. Renames labels that are miscategorized
# 3. Removes all "type: *" labels (replaced by GitHub issue types)
#
# Safe to run multiple times (idempotent).
set -euo pipefail
REPO="twentyhq/twenty"
echo "=== Issue Label Cleanup for $REPO ==="
# Labels to delete outright (typos, stale, or obsolete)
DELETE_LABELS=(
"hihg"
"for exa"
"HACKTOBERFEST_2025"
"type: bug"
"type: chore"
"type: feature"
"type: design improvement"
"type: documentation"
"type: marketing"
"type: SELF_HOST"
)
for label in "${DELETE_LABELS[@]}"; do
echo "Deleting label: '$label'"
gh label delete "$label" -R "$REPO" --yes 2>/dev/null || echo " (not found or already deleted)"
done
# Create new labels that the triage workflow needs
echo ""
echo "=== Creating new labels ==="
declare -A NEW_LABELS=(
["scope: self-host"]="bfd4f2:Issues specific to self-hosted deployments"
["needs: reproduction"]="fbca04:Bug reports that lack steps to reproduce"
["support"]="0075ca:Support questions / troubleshooting"
["size: medium"]="c2e0c6:Medium-sized task"
)
for label in "${!NEW_LABELS[@]}"; do
IFS=':' read -r color desc <<< "${NEW_LABELS[$label]}"
echo "Creating label: '$label' ($desc)"
gh label create "$label" -R "$REPO" --color "$color" --description "$desc" 2>/dev/null || echo " (already exists)"
done
echo ""
echo "=== Removing 'type: *' labels from existing issues ==="
# For each type label, find issues that have it and remove it
TYPE_LABELS=(
"type: bug"
"type: chore"
"type: feature"
"type: design improvement"
"type: documentation"
"type: marketing"
"type: SELF_HOST"
)
for label in "${TYPE_LABELS[@]}"; do
issues=$(gh issue list -R "$REPO" --state all --label "$label" --json number --jq '.[].number' 2>/dev/null || true)
if [ -n "$issues" ]; then
echo "Removing '$label' from issues: $issues"
for num in $issues; do
gh issue edit "$num" -R "$REPO" --remove-label "$label" 2>/dev/null || true
done
fi
done
echo ""
echo "=== Done! ==="
echo "Remaining labels:"
gh label list -R "$REPO" --limit 100