Files
xiaoxia-saas/scripts/ci_failure_check.sh
T
CI Bot 89bada5608 feat: add auto-merge scripts and CI failure notification
- Auto merge script for PRs targeting develop/main
- CI failure check script
- Gitea Actions workflow for scheduled auto-merge
- Cron jobs for periodic execution
2026-06-27 00:42:05 +08:00

31 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# 检查最近 CI 运行状态,失败时输出告警
GITEA_API="https://git.xiaoxiajianji.com/api/v1"
TOKEN="1f8058d097e3942a9ed31c44382baf7f08311272"
REPO="xiaoxia/xiaoxia-saas"
echo "=== CI Status Check ==="
echo "Time: $(date '+%Y-%m-%d %H:%M:%S')"
# 检查最近的 workflow runs
curl -s -H "Authorization: token $TOKEN" \
"$GITEA_API/repos/$REPO/actions/runs?limit=5" 2>/dev/null | python3 -c "
import json, sys
try:
data = json.load(sys.stdin)
runs = data.get('workflow_runs', [])
if not runs:
print('No recent CI runs found')
sys.exit(0)
for run in runs[:5]:
status = run.get('status', 'unknown')
conclusion = run.get('conclusion', 'pending')
name = run.get('name', 'unknown')
created = run.get('created_at', '')
print(f' {name}: {status} ({conclusion}) - {created}')
if conclusion == 'failure':
print(f' ⚠️ WARNING: CI failed for {name}')
except:
print('Could not parse CI status')
" 2>/dev/null || echo "CI status check unavailable"