|
|
@@ -0,0 +1,41 @@
|
|
|
+#!/bin/bash
|
|
|
+# filepath: /Users/zhch158/workspace/repository.git/dots.ocr/zhch/test_copilot_connection.sh
|
|
|
+
|
|
|
+PROXY_PORT=7280
|
|
|
+
|
|
|
+echo "Testing GitHub Copilot connectivity..."
|
|
|
+
|
|
|
+# 测试基本的 GitHub API 访问
|
|
|
+echo "1. Testing GitHub API..."
|
|
|
+if curl -s --proxy http://localhost:$PROXY_PORT --connect-timeout 10 https://api.github.com/user > /dev/null; then
|
|
|
+ echo "✓ GitHub API accessible"
|
|
|
+else
|
|
|
+ echo "✗ GitHub API not accessible"
|
|
|
+fi
|
|
|
+
|
|
|
+# 测试 Copilot 特定的端点
|
|
|
+echo "2. Testing Copilot proxy service..."
|
|
|
+if curl -s --proxy http://localhost:$PROXY_PORT --connect-timeout 10 https://copilot-proxy.githubusercontent.com > /dev/null; then
|
|
|
+ echo "✓ Copilot proxy service accessible"
|
|
|
+else
|
|
|
+ echo "✗ Copilot proxy service not accessible"
|
|
|
+fi
|
|
|
+
|
|
|
+# 测试用户内容服务
|
|
|
+echo "3. Testing GitHub user content..."
|
|
|
+if curl -s --proxy http://localhost:$PROXY_PORT --connect-timeout 10 https://raw.githubusercontent.com > /dev/null; then
|
|
|
+ echo "✓ GitHub user content accessible"
|
|
|
+else
|
|
|
+ echo "✗ GitHub user content not accessible"
|
|
|
+fi
|
|
|
+
|
|
|
+echo "4. Testing with authentication (if token available)..."
|
|
|
+if [ ! -z "$GITHUB_TOKEN" ]; then
|
|
|
+ if curl -s --proxy http://localhost:$PROXY_PORT -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user > /dev/null; then
|
|
|
+ echo "✓ GitHub authenticated API accessible"
|
|
|
+ else
|
|
|
+ echo "✗ GitHub authenticated API not accessible"
|
|
|
+ fi
|
|
|
+else
|
|
|
+ echo "ℹ GITHUB_TOKEN not set, skipping authenticated test"
|
|
|
+fi
|