#!/bin/bash # 配置信息 GITEA_URL="https://gitea.tailnet-68f9.ts.net" TOKEN="8d7d70f324796be650b79415303c31f567bf459b" # 函数:测试API端点 function test_endpoint() { local endpoint=$1 echo "测试端点: $endpoint" response=$(curl -s -w "\n%{http_code}" \ -H "Authorization: token $TOKEN" \ "$GITEA_URL$endpoint") # 分离响应内容和HTTP状态码 http_status=$(echo "$response" | tail -n1) response_body=$(echo "$response" | sed '$d') echo "HTTP状态码: $http_status" if [ "$http_status" -eq 200 ]; then echo "✓ 成功 - 响应: $response_body" elif [ "$http_status" -eq 404 ]; then echo "✗ 未找到" elif [ "$http_status" -eq 403 ] || [ "$http_status" -eq 401 ]; then echo "✗ 访问被拒绝 (可能权限不足)" else echo "✗ 其他错误 - 响应: $response_body" fi echo "---" } echo "=== 测试Gitea Actions Runner API端点 ===" echo "" # 测试可能的API端点 test_endpoint "/api/v1/actions/runners" test_endpoint "/api/v1/actions/runners/5" test_endpoint "/api/v1/admin/runners" test_endpoint "/api/v1/admin/runners/5" test_endpoint "/api/v1/user/actions/runners" test_endpoint "/api/v1/user/actions/runners/5" test_endpoint "/api/v1/users/ben/actions/runners" test_endpoint "/api/v1/repos/ben/modelscope/actions/runners"