This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
name: probe-visibility
|
||||
|
||||
# 一次性排查:验证 Gitee 企业仓「建仓时指定 private:false」是否直接得到公开仓,
|
||||
# 以及该令牌是否具备删仓权限。
|
||||
# 只在临时仓 __probe_vis 上操作,不动正式仓。
|
||||
# 以及该令牌是否具备删仓权限。只在临时仓 __probe_vis 上操作。
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -24,7 +23,7 @@ jobs:
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{\"name\":\"${NAME}\",\"auto_init\":false,\"private\":false,\"internal\":false,\"description\":\"临时探测仓\"}" \
|
||||
-o /tmp/create.json -w '建仓 HTTP %{http_code}\n' || true
|
||||
python3 -c "
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
try:
|
||||
d = json.load(open('/tmp/create.json'))
|
||||
@@ -34,26 +33,26 @@ if 'message' in d:
|
||||
print('message:', d.get('message'))
|
||||
else:
|
||||
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}"
|
||||
|
||||
echo "=== 3. 删临时仓 ==="
|
||||
curl -sS -m 25 -X DELETE \
|
||||
"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
|
||||
|
||||
echo "=== 4. 正式仓 website 当前可见性字段 ==="
|
||||
curl -sS -m 20 "https://gitee.com/api/v5/repos/${DST_OWNER}/website?access_token=${DST_TOKEN}" \
|
||||
| python3 -c "
|
||||
import sys, json
|
||||
d = json.load(sys.stdin)
|
||||
echo "=== 4. 正式仓 website 当前可见性 ==="
|
||||
curl -sS -m 20 "https://gitee.com/api/v5/repos/${DST_OWNER}/website?access_token=${DST_TOKEN}" -o /tmp/w.json
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
d = json.load(open('/tmp/w.json'))
|
||||
if 'message' in d:
|
||||
print('message:', d.get('message'))
|
||||
else:
|
||||
for k in ('path', 'private', 'internal', 'public', 'visibility'):
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user