chore: 探测建仓可见性参数与删仓权限(临时)
mirror-to-gitee / mirror (push) Successful in 5s

This commit is contained in:
技小云
2026-11-04 11:24:04 +08:00
committed by MiFaZhan
parent 4200e0fc53
commit 93fced52b9
+19 -20
View File
@@ -1,8 +1,7 @@
name: probe-visibility name: probe-visibility
# 一次性排查:验证 Gitee 企业仓「建仓时指定 private:false」是否直接得到公开仓, # 一次性排查:验证 Gitee 企业仓「建仓时指定 private:false」是否直接得到公开仓,
# 以及该令牌是否具备删仓权限。 # 以及该令牌是否具备删仓权限。只在临时仓 __probe_vis 上操作。
# 只在临时仓 __probe_vis 上操作,不动正式仓。
on: on:
workflow_dispatch: workflow_dispatch:
@@ -24,36 +23,36 @@ jobs:
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
-d "{\"name\":\"${NAME}\",\"auto_init\":false,\"private\":false,\"internal\":false,\"description\":\"临时探测仓\"}" \ -d "{\"name\":\"${NAME}\",\"auto_init\":false,\"private\":false,\"internal\":false,\"description\":\"临时探测仓\"}" \
-o /tmp/create.json -w '建仓 HTTP %{http_code}\n' || true -o /tmp/create.json -w '建仓 HTTP %{http_code}\n' || true
python3 -c " python3 - <<'PY'
import json import json
try: try:
d = json.load(open('/tmp/create.json')) d = json.load(open('/tmp/create.json'))
except Exception: except Exception:
print('parse fail'); raise SystemExit print('parse fail'); raise SystemExit
if 'message' in d: if 'message' in d:
print('message:', d.get('message')) print('message:', d.get('message'))
else: else:
print('path:', d.get('path'), '| private:', d.get('private'), '| internal:', d.get('internal')) print('path:', d.get('path'), '| private:', d.get('private'), '| internal:', d.get('internal'))
" PY
echo "=== 2. 匿名可见性(200=公开,403/404=不可见) ===" echo "=== 2. 匿名可见性(200=公开) ==="
curl -s -o /dev/null -w "匿名 ${NAME}: HTTP %{http_code}\n" -m 20 "https://gitee.com/${DST_OWNER}/${NAME}" curl -s -o /dev/null -w "匿名 ${NAME}: HTTP %{http_code}\n" -m 20 "https://gitee.com/${DST_OWNER}/${NAME}"
echo "=== 3. 删临时仓 ===" echo "=== 3. 删临时仓 ==="
curl -sS -m 25 -X DELETE \ curl -sS -m 25 -X DELETE \
"https://gitee.com/api/v5/repos/${DST_OWNER}/${NAME}?access_token=${DST_TOKEN}" \ "https://gitee.com/api/v5/repos/${DST_OWNER}/${NAME}?access_token=${DST_TOKEN}" \
-w '删仓 HTTP %{http_code}\n' -o /tmp/del.json || true -o /tmp/del.json -w '删仓 HTTP %{http_code}\n' || true
head -c 200 /tmp/del.json 2>/dev/null; echo head -c 200 /tmp/del.json 2>/dev/null; echo
echo "=== 4. 正式仓 website 当前可见性字段 ===" echo "=== 4. 正式仓 website 当前可见性 ==="
curl -sS -m 20 "https://gitee.com/api/v5/repos/${DST_OWNER}/website?access_token=${DST_TOKEN}" \ curl -sS -m 20 "https://gitee.com/api/v5/repos/${DST_OWNER}/website?access_token=${DST_TOKEN}" -o /tmp/w.json
| python3 -c " python3 - <<'PY'
import sys, json import json
d = json.load(sys.stdin) d = json.load(open('/tmp/w.json'))
if 'message' in d: if 'message' in d:
print('message:', d.get('message')) print('message:', d.get('message'))
else: else:
for k in ('path','private','internal','public','visibility'): for k in ('path', 'private', 'internal', 'public', 'visibility'):
print(k, '=', d.get(k)) print(k, '=', d.get(k))
" PY
curl -s -o /dev/null -w "匿名 website: HTTP %{http_code}\n" -m 20 "https://gitee.com/${DST_OWNER}/website" curl -s -o /dev/null -w "匿名 website: HTTP %{http_code}\n" -m 20 "https://gitee.com/${DST_OWNER}/website"