51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
name: probe-visibility
|
|
|
|
# 一次性排查:Gitee 端仓的可见性当前值,以及公开仓/私有仓的字段差异。
|
|
# 只读探测,不做修改。
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
probe:
|
|
runs-on: host
|
|
steps:
|
|
- name: 对比公开仓与门户仓的可见性字段
|
|
env:
|
|
DST_TOKEN: ${{ secrets.GITEE_TOKEN }}
|
|
DST_OWNER: ${{ secrets.GITEE_OWNER }}
|
|
run: |
|
|
set -u
|
|
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 "=== 企业仓列表里 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'))
|
|
"
|