#!/usr/bin/env bash # Idempotent: creates queue labels in Gitea and stores name→id map at .label-ids.json set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" . "$HERE/lib.sh" declare -A LABELS=( ["driver/abcip"]="0e8a16" ["driver/ablegacy"]="0e8a16" ["driver/focas"]="0e8a16" ["driver/opcuaclient"]="0e8a16" ["driver/s7"]="0e8a16" ["driver/twincat"]="0e8a16" ["phase/1"]="bfd4f2" ["phase/2"]="bfd4f2" ["phase/3"]="bfd4f2" ["phase/4"]="bfd4f2" ["phase/5"]="bfd4f2" ["phase/6"]="bfd4f2" ["queue/queued"]="d4c5f9" ["queue/in-progress"]="fbca04" ["queue/blocked"]="b60205" ["queue/failed"]="b60205" ["queue/done"]="2ea44f" ["auto-managed"]="cccccc" ["cross-driver"]="d93f0b" ) # Pull existing labels EXISTING=$(api_repo GET "labels?limit=200") emit_map() { python - </dev/null echo "created label: $name" fi done # Refresh and write the map file api_repo GET "labels?limit=200" | python -c " import json, sys ls = json.load(sys.stdin) m = {l['name']: l['id'] for l in ls} open('$LABEL_MAP','w').write(json.dumps(m, indent=2)) print(f'wrote {len(m)} labels to $LABEL_MAP') "