From 2548976f732ce7da9c0d8844e1aa98a85b1ef080 Mon Sep 17 00:00:00 2001 From: MiFaZhan Date: Mon, 2 Nov 2026 14:24:05 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=8E=A2=E6=B5=8B=20Gitee=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=AB=AF=E7=82=B9=EF=BC=88=E4=B8=80=E6=AC=A1=E6=80=A7?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/probe-gitee-delete.yml | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .gitea/workflows/probe-gitee-delete.yml diff --git a/.gitea/workflows/probe-gitee-delete.yml b/.gitea/workflows/probe-gitee-delete.yml new file mode 100644 index 0000000..2a168db --- /dev/null +++ b/.gitea/workflows/probe-gitee-delete.yml @@ -0,0 +1,46 @@ +name: probe-gitee-delete + +# 一次性探测:找出 Gitee 侧删除仓库的正确端点/权限。 +# 只对 iotlcm-sms 做探测,不实际删其它仓。 +on: + workflow_dispatch: + +jobs: + probe: + runs-on: host + steps: + - name: 探测 + env: + DST_TOKEN: ${{ secrets.GITEE_TOKEN }} + DST_OWNER: ${{ secrets.GITEE_OWNER }} + DST_USER: ${{ secrets.GITEE_USER }} + run: | + set -u + T="$DST_TOKEN"; O="$DST_OWNER"; R="iotlcm-sms" + t() { # 标签 方法 URL [data] + local label="$1" method="$2" url="$3" data="${4:-}" + if [ -n "$data" ]; then + code=$(curl -sS -o /tmp/b -w '%{http_code}' -X "$method" -H 'Content-Type: application/json' -d "$data" "$url") + else + code=$(curl -sS -o /tmp/b -w '%{http_code}' -X "$method" "$url") + fi + echo "[$label] $method $url -> $code $(head -c 200 /tmp/b)" + } + + echo "=== 令牌身份 / 权限 ===" + curl -sS "https://gitee.com/api/v5/user?access_token=$T" | head -c 400; echo + curl -sS "https://gitee.com/api/v5/enterprises/$O?access_token=$T" | head -c 400; echo + echo "--- 目标仓权限(permission 字段)---" + curl -sS "https://gitee.com/api/v5/repos/$O/$R?access_token=$T" \ + | python3 -c "import json,sys;d=json.load(sys.stdin);print({k:d.get(k) for k in ('full_name','permission','private','owner','namespace')})" 2>/dev/null + + echo "" + echo "=== 端点变体 ===" + t A DELETE "https://gitee.com/api/v5/repos/$O/$R?access_token=$T" + t B DELETE "https://gitee.com/api/v5/enterprises/$O/repos/$R?access_token=$T" + t C DELETE "https://gitee.com/api/v5/enterprises/$O/repos/$R?access_token=$T&path=$R" + t D POST "https://gitee.com/api/v5/enterprises/$O/repos/$R/archive?access_token=$T" + t E DELETE "https://gitee.com/api/v5/repos/$O/$R" "access_token=$T" + echo "" + echo "=== 探测后该仓是否还在 ===" + curl -sS -o /dev/null -w 'GET %{http_code}\n' "https://gitee.com/api/v5/repos/$O/$R?access_token=$T"