Delete unused ip-check workflow

This commit is contained in:
ben
2026-02-02 03:56:12 +00:00
parent ca4a838332
commit 9606c0f7f4
9 changed files with 445 additions and 21 deletions

40
scripts/delete-runner.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
# 配置信息
GITEA_URL="https://gitea.tailnet-68f9.ts.net"
TOKEN="8d7d70f324796be650b79415303c31f567bf459b"
# runner ID 从命令行参数获取默认为5
RUNNER_ID=${1:-5}
# 函数删除指定ID的runner
function delete_runner() {
local runner_id=$1
echo "尝试删除runner #$runner_id..."
response=$(curl -s -w "\n%{http_code}" -X DELETE \
-H "Authorization: token $TOKEN" \
"$GITEA_URL/api/v1/actions/runners/$runner_id")
# 分离响应内容和HTTP状态码
http_status=$(echo "$response" | tail -n1)
response_body=$(echo "$response" | sed '$d')
if [ "$http_status" -eq 204 ] || [ "$http_status" -eq 200 ]; then
echo "成功删除runner #$runner_id"
echo "响应: $response_body"
else
echo "删除runner #$runner_id 失败"
echo "HTTP状态码: $http_status"
echo "响应: $response_body"
fi
}
# 主脚本
echo "=== 删除Gitea Runner ==="
echo ""
# 直接删除runner
echo "将要删除runner ID: $RUNNER_ID"
delete_runner $RUNNER_ID