Files
market/.github/workflows/upstream-health.yml
T
mashagua 9054c3a2d1 将 Market 健康报告改为每天北京时间 09:20 (#375)
## 修改
仅将 `.github/workflows/upstream-health.yml` 的 cron 从 `23 1 * * *` 改为 `20
1 * * *`(UTC 01:20,北京时间每天 09:20),同步更新同行注释。

不改手动触发、审计步骤、权限、并发或 #213 发布逻辑。合并到默认分支后生效。GitHub Actions 的计划任务可能晚于设定时间开始。
2026-11-27 12:48:01 +08:00

108 lines
4.1 KiB
YAML

name: Upstream Health
# Daily check that every external pointer (skills/agents/teams entry.json)
# still resolves upstream. Results go to one tracking issue labelled
# `upstream-health`, which is updated in place and closed once nothing is
# actionable. Fixing an entry stays a normal reviewed PR; this workflow never
# rewrites the default branch. Verified Skill updates get normal PRs; blocked audits remain explicit drafts.
on:
schedule:
- cron: "20 1 * * *" # Daily 01:20 UTC
workflow_dispatch:
permissions:
contents: write
issues: write
pull-requests: write
concurrency:
group: upstream-health
cancel-in-progress: false
jobs:
check:
if: github.repository == 'desirecore/market'
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Check upstreams
id: check
run: |
set +e
uv run --quiet scripts/catalog/check_upstream_health.py --format markdown --summary-file summary.json --results-file results.json > report.md
code=$?
set -e
if [ "$code" -gt 1 ]; then
echo "health check crashed with exit code $code" >&2
exit "$code"
fi
python3 - <<'PY' >> "$GITHUB_OUTPUT"
import json
from pathlib import Path
summary = json.loads(Path("summary.json").read_text())
for key in ("broken", "actionable", "unknown", "held"):
print(f"{key}={str(summary[key]).lower()}")
PY
cat report.md >> "$GITHUB_STEP_SUMMARY"
- name: Propose reviewed-source updates
id: propose
env:
GH_TOKEN: ${{ secrets.MARKET_MAINTAINER_TOKEN || github.token }}
MAINTAINER_TOKEN_AVAILABLE: ${{ secrets.MARKET_MAINTAINER_TOKEN != '' }}
MARKET_MAINTAINER_LOGIN: mashagua
GIT_CONFIG_COUNT: '1'
GIT_CONFIG_KEY_0: credential.helper
GIT_CONFIG_VALUE_0: '!gh auth git-credential'
run: |
publish=()
if [ "$MAINTAINER_TOKEN_AVAILABLE" = true ]; then
publish=(--publish)
else
echo 'Maintainer authentication not configured: audit-only, no bot-authored PR fallback.' >> "$GITHUB_STEP_SUMMARY"
fi
uv run --quiet scripts/catalog/propose_upstream_updates.py results.json "${publish[@]}" --limit 5 --coverage-file coverage.json
uv run --quiet scripts/catalog/publish_tracked_updates.py "${publish[@]}" --limit 5 --report-file tracked-results.json
- name: 展示所有技能的覆盖与阻碍
if: always()
run: |
if [ -f coverage.md ]; then cat coverage.md >> "$GITHUB_STEP_SUMMARY"; else echo '覆盖报告未生成,来源核验未完成。' >> "$GITHUB_STEP_SUMMARY"; fi
- name: 双语审核报告与跟踪 issue / Bilingual audit report and tracking issue
if: always() && steps.check.outcome == 'success'
env:
GH_TOKEN: ${{ github.token }}
PROPOSAL_COMPLETE: ${{ steps.propose.outcome == 'success' }}
run: |
complete=()
if [ "$PROPOSAL_COMPLETE" = true ]; then complete=(--complete); fi
uv run --quiet --with pyyaml python scripts/catalog/unhealthy_report.py --results results.json --coverage coverage.json --tracked tracked-results.json --output unhealthy-report.md "${complete[@]}" --publish
cat unhealthy-report.md >> "$GITHUB_STEP_SUMMARY"
- name: 保留真实逐项审核证据 / Preserve per-item audit evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: audit-results
path: |
results.json
summary.json
coverage.json
coverage.md
tracked-results.json
unhealthy-report.md
if-no-files-found: warn
- name: Fail when an entry is broken
if: steps.check.outputs.broken == 'true'
run: |
echo "::error::At least one external entry no longer resolves upstream; see the upstream-health issue."
exit 1