#!/bin/bash

# Script to remove user i-ayushh18 from repositories
# This script uses the improved remove_user_interactive.sh

set -euo pipefail

# Check if GITHUB_TOKEN is set
if [[ -z "${GITHUB_TOKEN:-}" ]]; then
    echo "❌ Error: GITHUB_TOKEN environment variable is not set"
    echo "Please set your GitHub Personal Access Token:"
    echo "export GITHUB_TOKEN='your_token_here'"
    exit 1
fi

echo "🚀 Starting removal process for user: i-ayushh18"
echo "📋 This will:"
echo "   1. Check which repositories i-ayushh18 is actually a collaborator on"
echo "   2. Show a preview of repositories where they will be removed"
echo "   3. Remove them from those repositories"
echo ""

# Run the improved script with non-interactive mode
./remove_user_interactive.sh \
    --user "i-ayushh18" \
    --root "saravanakumardb" \
    --pattern "*" \
    --token "$GITHUB_TOKEN" \
    --non-interactive

echo ""
echo "✅ Removal process completed for user: i-ayushh18"
