From a7c15cf891dda091e945ec6f45e8190a17e81a77 Mon Sep 17 00:00:00 2001 From: MiFaZhan Date: Mon, 2 Nov 2026 14:25:34 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=80=A7=E6=8E=A2=E6=B5=8B/=E6=B8=85=E7=90=86=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=EF=BC=88Gitee=20=E5=88=A0=E9=99=A4=E9=9C=80?= =?UTF-8?q?=20projects=20=E6=9D=83=E9=99=90=EF=BC=8CAPI=20=E4=BE=A7=20403?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/cleanup-old-gitee-repos.yml | 58 -------------------- .gitea/workflows/probe-gitee-delete.yml | 46 ---------------- 2 files changed, 104 deletions(-) delete mode 100644 .gitea/workflows/cleanup-old-gitee-repos.yml delete mode 100644 .gitea/workflows/probe-gitee-delete.yml diff --git a/.gitea/workflows/cleanup-old-gitee-repos.yml b/.gitea/workflows/cleanup-old-gitee-repos.yml deleted file mode 100644 index 2fc7674..0000000 --- a/.gitea/workflows/cleanup-old-gitee-repos.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: cleanup-old-gitee-repos - -# 一次性任务:删除 Gitee 企业仓下 12 个已并入单仓的旧仓。 -# 结果写入 report.txt 并作为 artifact 上传(Gitea 日志无读取 API,只能靠 artifact 回报)。 -on: - workflow_dispatch: - -jobs: - cleanup: - runs-on: host - steps: - - name: 删除旧仓并生成报告 - env: - DST_TOKEN: ${{ secrets.GITEE_TOKEN }} - DST_OWNER: ${{ secrets.GITEE_OWNER }} - run: | - set -u - REPORT="$PWD/report.txt" - : > "$REPORT" - log() { echo "$@" | tee -a "$REPORT"; } - - REPOS="iotlcm-admin-svr iotlcm-admin-ui iotlcm-app iotlcm-bot iotlcm-deploy iotlcm-docs iotlcm-onelink-mock iotlcm-openapi iotlcm-sms iotlcm-upstream-chan iotlcm-upstream-proxy iotlcm-worker-svr" - - log "=== 1. 删除(DELETE /repos/{owner}/{repo})===" - for r in $REPOS; do - if [ "$r" = "iotlcm" ]; then log "❌ 拒绝删除单仓"; exit 1; fi - code=$(curl -sS -o /tmp/b -w '%{http_code}' -X DELETE \ - "https://gitee.com/api/v5/repos/${DST_OWNER}/${r}?access_token=${DST_TOKEN}") - log "DELETE ${r} -> $code $(head -c 120 /tmp/b)" - done - - log "" - log "=== 2. 复核(期望 404)===" - for r in $REPOS; do - code=$(curl -sS -o /tmp/b -w '%{http_code}' \ - "https://gitee.com/api/v5/repos/${DST_OWNER}/${r}?access_token=${DST_TOKEN}") - log "GET ${r} -> $code" - done - - log "" - log "=== 3. 单仓仍须 200 ===" - code=$(curl -sS -o /tmp/b -w '%{http_code}' \ - "https://gitee.com/api/v5/repos/${DST_OWNER}/iotlcm?access_token=${DST_TOKEN}") - log "GET iotlcm -> $code $(head -c 160 /tmp/b)" - - log "" - log "=== 4. 企业仓列表(前 2000 字符)===" - curl -sS "https://gitee.com/api/v5/enterprises/${DST_OWNER}/repos?access_token=${DST_TOKEN}&per_page=100" \ - | head -c 2000 | tee -a "$REPORT" - log "" - log "=== done ===" - - - name: 上传报告 - if: always() - uses: actions/upload-artifact@v3 - with: - name: cleanup-report - path: report.txt diff --git a/.gitea/workflows/probe-gitee-delete.yml b/.gitea/workflows/probe-gitee-delete.yml deleted file mode 100644 index 2a168db..0000000 --- a/.gitea/workflows/probe-gitee-delete.yml +++ /dev/null @@ -1,46 +0,0 @@ -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"