Files
modelscope/scripts/list-runners.sh
2026-02-02 03:56:12 +00:00

42 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 配置信息
GITEA_URL="https://gitea.tailnet-68f9.ts.net"
TOKEN="8d7d70f324796be650b79415303c31f567bf459b"
# 函数列出所有runners
function list_runners() {
echo "尝试获取runners列表..."
# 尝试不同的API端点
endpoints=("/api/v1/actions/runners" "/api/v1/runners" "/api/v1/admin/runners")
for endpoint in "${endpoints[@]}"; do
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 "成功获取runners列表:"
echo "$response_body"
return 0
else
echo "失败 - 响应: $response_body"
echo "---"
fi
done
echo "无法通过任何已知端点获取runners列表"
return 1
}
# 主脚本
echo "=== 列出Gitea Runners ==="
echo ""
list_runners