Delete unused ip-check workflow
This commit is contained in:
42
scripts/list-runners.sh
Executable file
42
scripts/list-runners.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user