Files
website/.gitea/workflows/probe-visibility.yml
T
Workflow config file is invalid. Please check your config file: model.ReadWorkflow: yaml: line 28: could not find expected ':'
技小云 4200e0fc53
mirror-to-gitee / mirror (push) Successful in 4s
chore: 探测建仓可见性参数与删仓权限(临时)
2026-11-04 11:22:30 +08:00

60 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: probe-visibility
# 一次性排查:验证 Gitee 企业仓「建仓时指定 private:false」是否直接得到公开仓,
# 以及该令牌是否具备删仓权限。
# 只在临时仓 __probe_vis 上操作,不动正式仓。
on:
workflow_dispatch:
jobs:
probe:
runs-on: host
steps:
- name: 验证建仓可见性参数与删仓权限
env:
DST_TOKEN: ${{ secrets.GITEE_TOKEN }}
DST_OWNER: ${{ secrets.GITEE_OWNER }}
run: |
set -u
NAME="__probe_vis"
echo "=== 1. 建仓(private:false + internal:false) ==="
curl -sS -m 25 -X POST \
"https://gitee.com/api/v5/enterprises/${DST_OWNER}/repos?access_token=${DST_TOKEN}" \
-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 "
import json
try:
d = json.load(open('/tmp/create.json'))
except Exception:
print('parse fail'); raise SystemExit
if 'message' in d:
print('message:', d.get('message'))
else:
print('path:', d.get('path'), '| private:', d.get('private'), '| internal:', d.get('internal'))
"
echo "=== 2. 匿名可见性(200=公开,403/404=不可见) ==="
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
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)
if 'message' in d:
print('message:', d.get('message'))
else:
for k in ('path','private','internal','public','visibility'):
print(k, '=', d.get(k))
"
curl -s -o /dev/null -w "匿名 website: HTTP %{http_code}\n" -m 20 "https://gitee.com/${DST_OWNER}/website"