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"