/ setup-github.sh
setup-github.sh
 1  #!/bin/bash
 2  # GitHub Setup Script for acdc-botnet
 3  # Run this script with your GitHub token to complete the setup
 4  
 5  set -e
 6  
 7  # Check for token
 8  if [ -z "$GITHUB_TOKEN" ]; then
 9    echo "❌ Error: GITHUB_TOKEN environment variable not set"
10    echo ""
11    echo "To set your token:"
12    echo "  export GITHUB_TOKEN='your_github_personal_access_token'"
13    echo ""
14    echo "To create a token:"
15    echo "  1. Go to: https://github.com/settings/tokens"
16    echo "  2. Click 'Generate new token (classic)'"
17    echo "  3. Select scopes: repo, admin:org"
18    echo "  4. Copy the token and export it"
19    exit 1
20  fi
21  
22  echo "🚀 Creating GitHub repository: alpha-delta-network/acdc-botnet"
23  
24  # Create repository
25  RESPONSE=$(curl -s -X POST https://api.github.com/orgs/alpha-delta-network/repos \
26    -H "Authorization: token ${GITHUB_TOKEN}" \
27    -H "Content-Type: application/json" \
28    -d '{
29      "name": "acdc-botnet",
30      "description": "Distributed bot testing infrastructure for Alpha/Delta protocol. 31 scenarios, 99% coverage, formal correctness.",
31      "private": false,
32      "has_issues": true,
33      "has_wiki": true,
34      "has_projects": true,
35      "homepage": "https://source.ac-dc.network/alpha-delta-network/acdc-botnet"
36    }')
37  
38  # Check if creation was successful
39  if echo "$RESPONSE" | grep -q '"full_name"'; then
40    echo "✅ Repository created successfully!"
41    echo ""
42    
43    # Add GitHub remote
44    cd /home/devops/working-repos/acdc-botnet
45    if ! git remote | grep -q "github"; then
46      git remote add github https://github.com/alpha-delta-network/acdc-botnet.git
47      echo "✅ GitHub remote added"
48    fi
49    
50    # Push to GitHub
51    echo "📤 Pushing to GitHub..."
52    git push github master
53    
54    echo ""
55    echo "✅ Setup complete!"
56    echo "📍 GitHub: https://github.com/alpha-delta-network/acdc-botnet"
57    echo "📍 Forgejo: https://source.ac-dc.network/alpha-delta-network/acdc-botnet"
58    echo "📍 Radicle: rad:z2WYmpZk4rXZ3K3ToSF6ndfuRNNGa"
59  else
60    echo "❌ Error creating repository:"
61    echo "$RESPONSE" | jq '.'
62    exit 1
63  fi