44 lines
1.2 KiB
Bash
44 lines
1.2 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
# Sync labels from core-agent to other repos in host-uk org
|
||
|
|
# Usage: ./sync-labels.sh [repo1] [repo2] ...
|
||
|
|
# If no repos specified, syncs to all core-* repos
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
SOURCE_REPO="host-uk/core-agent"
|
||
|
|
|
||
|
|
# Get labels from source
|
||
|
|
labels=$(gh label list -R "$SOURCE_REPO" --json name,color,description --limit 100)
|
||
|
|
|
||
|
|
sync_to_repo() {
|
||
|
|
local repo=$1
|
||
|
|
echo "Syncing labels to $repo..."
|
||
|
|
|
||
|
|
echo "$labels" | jq -c '.[]' | while read -r label; do
|
||
|
|
name=$(echo "$label" | jq -r '.name')
|
||
|
|
color=$(echo "$label" | jq -r '.color')
|
||
|
|
desc=$(echo "$label" | jq -r '.description')
|
||
|
|
|
||
|
|
# Try to create, if exists try to update
|
||
|
|
if ! gh label create "$name" --color "$color" --description "$desc" -R "$repo" 2>/dev/null; then
|
||
|
|
gh label edit "$name" --color "$color" --description "$desc" -R "$repo" 2>/dev/null || true
|
||
|
|
fi
|
||
|
|
done
|
||
|
|
|
||
|
|
echo " Done: $repo"
|
||
|
|
}
|
||
|
|
|
||
|
|
if [ $# -eq 0 ]; then
|
||
|
|
# Sync to all core-* repos
|
||
|
|
for repo in host-uk/core-{php,tenant,admin,api,mcp,agentic,bio,social,analytics,notify,trust,support,commerce,content,tools,uptelligence,developer}; do
|
||
|
|
sync_to_repo "$repo"
|
||
|
|
done
|
||
|
|
else
|
||
|
|
for repo in "$@"; do
|
||
|
|
sync_to_repo "$repo"
|
||
|
|
done
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo ""
|
||
|
|
echo "Label sync complete!"
|