chore: 探测可见性字段(临时)
mirror-to-gitee / mirror (push) Successful in 2s

This commit is contained in:
技小云
2026-11-04 11:21:20 +08:00
committed by MiFaZhan
parent 6b02f2a275
commit d28be419b5
+35 -26
View File
@@ -1,7 +1,7 @@
name: probe-visibility
# 一次性排查:为什么 Gitee 端仓的可见性改不成公开。
# 只读探测 + 报告,不做删除等破坏性动作。
# 一次性排查:Gitee 端仓的可见性当前值,以及公开仓/私有仓的字段差异。
# 只读探测,不做修改。
on:
workflow_dispatch:
@@ -9,33 +9,42 @@ jobs:
probe:
runs-on: host
steps:
- name: 探测仓库可见性相关端点
- name: 对比公开仓与门户仓的可见性字段
env:
DST_TOKEN: ${{ secrets.GITEE_TOKEN }}
DST_OWNER: ${{ secrets.GITEE_OWNER }}
DST_USER: ${{ secrets.GITEE_USER }}
run: |
set -u
NAME="website"
echo "=== A. GET 当前仓库信息 ==="
curl -sS -m 20 "https://gitee.com/api/v5/repos/${DST_OWNER}/${NAME}?access_token=${DST_TOKEN}" \
-w '\nHTTP %{http_code}\n' | head -c 800; echo
for NAME in iotlcm xiu-dtu website; do
echo "=== $NAME ==="
curl -sS -m 20 "https://gitee.com/api/v5/repos/${DST_OWNER}/${NAME}?access_token=${DST_TOKEN}" \
| python3 -c "
import sys, json
try:
d = json.load(sys.stdin)
except Exception:
print('parse fail'); raise SystemExit
if 'message' in d:
print('message:', d.get('message'))
else:
for k in ('path','private','internal','public','visibility','open_issue','owner'):
v = d.get(k)
if isinstance(v, dict):
v = v.get('login') or v.get('name')
print(f'{k}: {v}')
"
done
echo "=== B. PATCH + query access_token ==="
curl -sS -m 20 -X PATCH \
"https://gitee.com/api/v5/repos/${DST_OWNER}/${NAME}?access_token=${DST_TOKEN}" \
-H 'Content-Type: application/json' \
-d "{\"name\":\"${NAME}\",\"private\":false,\"internal\":false}" \
-w '\nHTTP %{http_code}\n' | head -c 500; echo
echo "=== C. PATCH + Authorization 头 ==="
curl -sS -m 20 -X PATCH \
"https://gitee.com/api/v5/repos/${DST_OWNER}/${NAME}" \
-H "Authorization: token ${DST_TOKEN}" \
-H 'Content-Type: application/json' \
-d "{\"name\":\"${NAME}\",\"private\":false,\"internal\":false}" \
-w '\nHTTP %{http_code}\n' | head -c 500; echo
echo "=== D. 企业仓下的仓库列表(看 visibility 字段名) ==="
curl -sS -m 20 "https://gitee.com/api/v5/enterprises/${DST_OWNER}/repos?access_token=${DST_TOKEN}&per_page=20" \
| head -c 1200; echo
echo "=== 企业仓列表里 website 的可见性 ==="
curl -sS -m 20 "https://gitee.com/api/v5/enterprises/${DST_OWNER}/repos?access_token=${DST_TOKEN}&per_page=100" \
| python3 -c "
import sys, json
try:
d = json.load(sys.stdin)
except Exception:
print('parse fail'); raise SystemExit
if isinstance(d, dict):
print('message:', d.get('message')); raise SystemExit
for r in d:
print(r.get('path'), '| private:', r.get('private'), '| internal:', r.get('internal'))
"