Skip to content

Instantly share code, notes, and snippets.

@d-oit
Last active September 4, 2025 17:24
Show Gist options
  • Save d-oit/c280da85decdb0037d29f776f54b710f to your computer and use it in GitHub Desktop.
Save d-oit/c280da85decdb0037d29f776f54b710f to your computer and use it in GitHub Desktop.

Revisions

  1. d-oit revised this gist Aug 15, 2025. 1 changed file with 41 additions and 25 deletions.
    66 changes: 41 additions & 25 deletions gh-labels-creator.sh
    Original file line number Diff line number Diff line change
    @@ -10,35 +10,51 @@ fi

    # Prompt for confirmation to delete all existing labels
    read -p "Delete ALL existing labels? (y/N) " confirm
    if [[ "$confirm" =~ ^[Yy]$ ]]; then

    # More robust confirmation check
    if [[ "$confirm" == "y" ]] || [[ "$confirm" == "Y" ]] || [[ "$confirm" == "yes" ]] || [[ "$confirm" == "YES" ]]; then
    echo "Deleting all existing labels..."
    gh label list --json name --jq '.[].name' | xargs -r -I {} gh label delete {} --yes || {
    echo "Error deleting labels. Continuing with label creation..."
    }

    # Get all label names and delete them
    label_names=$(gh label list --json name --jq '.[].name')

    if [[ -n "$label_names" ]]; then
    echo "$label_names" | while IFS= read -r label; do
    if [[ -n "$label" ]]; then
    echo "Deleting label: $label"
    gh label delete "$label" --yes || echo "Failed to delete: $label"
    fi
    done
    echo "Label deletion completed."
    else
    echo "No labels found to delete."
    fi
    else
    echo "Skipping label deletion."
    fi

    gh label create "bug" --color d73a4a --description "Something isn't working"
    gh label create "feature" --color a2eeef --description "New feature request"
    gh label create "documentation" --color 0075ca --description "Improvements or additions to documentation"
    gh label create "question" --color d876e3 --description "Further information is requested"
    gh label create "discussion" --color 8b949e --description "Open-ended conversation or design discussion"
    gh label create "security" --color b60205 --description "Security-related issue"

    gh label create "priority: high" --color b60205 --description "Critical, needs immediate attention"
    gh label create "priority: medium" --color fbca04 --description "Important but not urgent"
    gh label create "priority: low" --color 0e8a16 --description "Low urgency, can wait"
    gh label create "blocked" --color e4e669 --description "Cannot proceed due to dependency/blocker"
    # Create new labels
    echo "Creating labels..."

    gh label create "status: in progress" --color 1d76db --description "Currently being worked on"
    gh label create "status: needs review" --color dbab09 --description "Waiting for review"
    gh label create "status: needs triage" --color e4e669 --description "Needs categorization or investigation"
    gh label create "status: duplicate" --color cccccc --description "Duplicate of another issue/PR"
    gh label create "status: wontfix" --color ffffff --description "Not planned to be fixed or implemented"
    gh label create "bug" --color d73a4a --description "Something isn't working" --force
    gh label create "feature" --color a2eeef --description "New feature request" --force
    gh label create "documentation" --color 0075ca --description "Improvements or additions to documentation" --force
    gh label create "question" --color d876e3 --description "Further information is requested" --force
    gh label create "discussion" --color 8b949e --description "Open-ended conversation or design discussion" --force
    gh label create "security" --color b60205 --description "Security-related issue" --force
    gh label create "priority: high" --color b60205 --description "Critical, needs immediate attention" --force
    gh label create "priority: medium" --color fbca04 --description "Important but not urgent" --force
    gh label create "priority: low" --color 0e8a16 --description "Low urgency, can wait" --force
    gh label create "blocked" --color e4e669 --description "Cannot proceed due to dependency/blocker" --force
    gh label create "status: in progress" --color 1d76db --description "Currently being worked on" --force
    gh label create "status: needs review" --color dbab09 --description "Waiting for review" --force
    gh label create "status: needs triage" --color e4e669 --description "Needs categorization or investigation" --force
    gh label create "status: duplicate" --color cccccc --description "Duplicate of another issue/PR" --force
    gh label create "status: wontfix" --color ffffff --description "Not planned to be fixed or implemented" --force
    gh label create "refactor" --color 0366d6 --description "Code improvements without behavior change" --force
    gh label create "performance" --color 5319e7 --description "Performance-related improvement" --force
    gh label create "tests" --color f4c542 --description "Related to automated/manual tests" --force
    gh label create "chore" --color fef2c0 --description "Maintenance task, tooling update, cleanup" --force
    gh label create "deps" --color cfd3d7 --description "Dependency updates or changes" --force

    gh label create "refactor" --color 0366d6 --description "Code improvements without behavior change"
    gh label create "performance" --color 5319e7 --description "Performance-related improvement"
    gh label create "tests" --color f4c542 --description "Related to automated/manual tests"
    gh label create "chore" --color fef2c0 --description "Maintenance task, tooling update, cleanup"
    gh label create "deps" --color cfd3d7 --description "Dependency updates or changes"
    echo "Label creation completed!"
  2. d-oit revised this gist Aug 14, 2025. 1 changed file with 21 additions and 3 deletions.
    24 changes: 21 additions & 3 deletions gh-labels-creator.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,23 @@
    # Install GitHub CLI if not installed
    # https://cli.github.com/
    #!/bin/bash

    # Check if GitHub CLI and jq are installed
    if ! command -v gh &> /dev/null || ! command -v jq &> /dev/null; then
    echo "Error: GitHub CLI (gh) and jq are required."
    echo "Install gh: https://cli.github.com/"
    echo "Install jq: https://stedolan.github.io/jq/"
    exit 1
    fi

    # Prompt for confirmation to delete all existing labels
    read -p "Delete ALL existing labels? (y/N) " confirm
    if [[ "$confirm" =~ ^[Yy]$ ]]; then
    echo "Deleting all existing labels..."
    gh label list --json name --jq '.[].name' | xargs -r -I {} gh label delete {} --yes || {
    echo "Error deleting labels. Continuing with label creation..."
    }
    else
    echo "Skipping label deletion."
    fi

    gh label create "bug" --color d73a4a --description "Something isn't working"
    gh label create "feature" --color a2eeef --description "New feature request"
    @@ -23,4 +41,4 @@ gh label create "refactor" --color 0366d6 --description "Code improvements witho
    gh label create "performance" --color 5319e7 --description "Performance-related improvement"
    gh label create "tests" --color f4c542 --description "Related to automated/manual tests"
    gh label create "chore" --color fef2c0 --description "Maintenance task, tooling update, cleanup"
    gh label create "deps" --color cfd3d7 --description "Dependency updates or changes"
    gh label create "deps" --color cfd3d7 --description "Dependency updates or changes"
  3. d-oit revised this gist Aug 14, 2025. 2 changed files with 26 additions and 5 deletions.
    26 changes: 26 additions & 0 deletions gh-labels-creator.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    # Install GitHub CLI if not installed
    # https://cli.github.com/

    gh label create "bug" --color d73a4a --description "Something isn't working"
    gh label create "feature" --color a2eeef --description "New feature request"
    gh label create "documentation" --color 0075ca --description "Improvements or additions to documentation"
    gh label create "question" --color d876e3 --description "Further information is requested"
    gh label create "discussion" --color 8b949e --description "Open-ended conversation or design discussion"
    gh label create "security" --color b60205 --description "Security-related issue"

    gh label create "priority: high" --color b60205 --description "Critical, needs immediate attention"
    gh label create "priority: medium" --color fbca04 --description "Important but not urgent"
    gh label create "priority: low" --color 0e8a16 --description "Low urgency, can wait"
    gh label create "blocked" --color e4e669 --description "Cannot proceed due to dependency/blocker"

    gh label create "status: in progress" --color 1d76db --description "Currently being worked on"
    gh label create "status: needs review" --color dbab09 --description "Waiting for review"
    gh label create "status: needs triage" --color e4e669 --description "Needs categorization or investigation"
    gh label create "status: duplicate" --color cccccc --description "Duplicate of another issue/PR"
    gh label create "status: wontfix" --color ffffff --description "Not planned to be fixed or implemented"

    gh label create "refactor" --color 0366d6 --description "Code improvements without behavior change"
    gh label create "performance" --color 5319e7 --description "Performance-related improvement"
    gh label create "tests" --color f4c542 --description "Related to automated/manual tests"
    gh label create "chore" --color fef2c0 --description "Maintenance task, tooling update, cleanup"
    gh label create "deps" --color cfd3d7 --description "Dependency updates or changes"
    5 changes: 0 additions & 5 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +0,0 @@
    gh label create "npm" --description "NPM ecosystem updates" --color cb3837
    gh label create "github-actions" --description "GitHub Actions workflow updates" --color 2088ff
    gh label create "security" --description "Security-related updates" --color b60205
    gh label create "priority-high" --description "High-priority issues" --color e11d48
    gh label create "dependencies" --description "For tracking dependency updates" --color 0366d6
  4. d-oit created this gist Jul 14, 2025.
    5 changes: 5 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    gh label create "npm" --description "NPM ecosystem updates" --color cb3837
    gh label create "github-actions" --description "GitHub Actions workflow updates" --color 2088ff
    gh label create "security" --description "Security-related updates" --color b60205
    gh label create "priority-high" --description "High-priority issues" --color e11d48
    gh label create "dependencies" --description "For tracking dependency updates" --color 0366d6