docs-v2/helper-scripts/label-migration/create-labels.sh

98 lines
3.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Create all labels defined in the doc review pipeline plan.
# Safe and idempotent — uses --force to update existing labels.
#
# Usage:
# ./create-labels.sh # Create labels in influxdata/docs-v2
# ./create-labels.sh --dry-run # Print commands without executing
# REPO=owner/repo ./create-labels.sh # Target a different repo
REPO="${REPO:-influxdata/docs-v2}"
DRY_RUN=false
if [[ "${1:-}" == "--dry-run" ]]; then
DRY_RUN=true
echo "=== DRY RUN — no labels will be created ==="
echo
fi
create_label() {
local name="$1"
local color="$2"
local description="$3"
if $DRY_RUN; then
printf " %-30s #%-6s %s\n" "$name" "$color" "$description"
else
if gh label create "$name" \
--repo "$REPO" \
--color "$color" \
--description "$description" \
--force 2>/dev/null; then
printf " ✓ %-30s\n" "$name"
else
printf " ✗ %-30s (failed)\n" "$name"
fi
fi
}
echo "Repository: $REPO"
echo
# --- Product labels (11) — yellow ---
echo "Product labels:"
create_label "product:v3-monolith" "FFA500" "InfluxDB 3 Core and Enterprise (single-node / clusterable)"
create_label "product:v3-distributed" "FFA500" "InfluxDB 3 Cloud Serverless, Cloud Dedicated, Clustered"
create_label "product:v2" "FFA500" "InfluxDB v2 (Cloud TSM, OSS)"
create_label "product:v1" "FFA500" "InfluxDB v1 OSS"
create_label "product:v1-enterprise" "FFA500" "InfluxDB Enterprise v1"
create_label "product:telegraf" "FFA500" "Telegraf documentation"
create_label "product:chronograf" "FFA500" "Chronograf documentation"
create_label "product:kapacitor" "FFA500" "Kapacitor documentation"
create_label "product:flux" "FFA500" "Flux language documentation"
create_label "product:explorer" "FFA500" "InfluxDB 3 Explorer"
create_label "product:shared" "FFA500" "Shared content across products"
echo
# --- Source tracking labels (4) — purple ---
echo "Source tracking labels:"
create_label "source:auto-detected" "9370DB" "Created by change detection within this repo"
create_label "source:dar" "9370DB" "Generated by DAR pipeline (issue analysis)"
create_label "source:sync" "9370DB" "Synced from an external repository"
create_label "source:manual" "9370DB" "Human-created issue"
echo
# --- Waiting states (2) — orange ---
echo "Waiting state labels:"
create_label "waiting:engineering" "FF8C00" "Waiting for engineer confirmation"
create_label "waiting:product" "FF8C00" "Waiting for product/PM decision"
echo
# --- Workflow states (2) — green/blue ---
echo "Workflow state labels:"
create_label "agent-ready" "00FF00" "Agent can work on this autonomously"
create_label "skip-review" "1E90FF" "Skip automated doc review pipeline"
echo
# --- Review outcome labels (3) — green/red/yellow ---
echo "Review outcome labels:"
create_label "review:approved" "28A745" "Automated review passed — no blocking issues"
create_label "review:changes-requested" "DC3545" "Automated review found blocking issues"
create_label "review:needs-human" "FFC107" "Automated review inconclusive, needs human"
echo
# --- Renamed labels (2) ---
echo "Renamed labels:"
create_label "ai:tooling" "3fb91f" "Related to AI assistant infrastructure"
create_label "ci:testing" "a1fd0f" "CI/testing infrastructure"
echo
# --- Ensure existing workflow labels exist ---
echo "Existing labels (ensure present):"
create_label "release:pending" "FEF2C0" "Waiting for product release before merging"
echo
echo "Done. Total: 24 new + 1 existing = 25 labels."