Files
market/.github/workflows/upstream-health.yml
yi-ge 10cb7656db fix: 上游巡检收窄集合对比范围并支持已审查暂缓
Collections install only their declared children: the client copies each selected child path at the pinned ref. Yet `outdated` compared the whole upstream repository, so CLI sources, end-to-end tests and changesets forced repins. Compare the declared child paths plus root license/notice files instead; undeclared upstream skills are still reported as `new-skill`.

A pin kept on purpose after review was reported again every week, so the tracking issue could never close. A reviewed `upstream-health-hold.json` beside `entry.json` now reports its listed `upstream-path-change`/`outdated` findings as `held` (not actionable) while the pin and the installed-scope content at the reviewed upstream head are unchanged. Otherwise the findings return with an actionable `stale-hold`. Broken, unreachable, `new-skill` and `unpinned` findings cannot be held. CI tests require every hold to be well-formed and to match its entry's `source.ref`. A network error while checking a reviewed head stays `unreachable`.

`outdated` rows in the tracking issue now link to the GitHub compare view. The summary JSON reports the held count, and the closing comment mentions remaining holds. Both READMEs document the comparison scope, the hold format and the links.

Validation: 42 upstream-health, 10 collection-generator, 51 catalog-metadata and 19 i18n tests pass. Catalog metadata, i18n (0 errors, 106 existing warnings) and translation-freshness checks pass. actionlint and `git diff --check` are clean. A live run over 111 entries reports no broken or unknown entries, and humanlayer-skills is no longer `outdated`. A temporary geo-optimizer hold turned both of its findings into `held` with `actionable: false`; it is not committed.

Refs #213.
2026-10-18 18:35:38 +08:00

95 lines
3.7 KiB
YAML

name: Upstream Health
# Weekly 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 catalog files.
on:
schedule:
- cron: "23 1 * * 1" # Mondays 01:23 UTC
workflow_dispatch:
permissions:
contents: read
issues: write
concurrency:
group: upstream-health
cancel-in-progress: false
jobs:
check:
if: github.repository == 'desirecore/market'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- 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 > 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: Update tracking issue
env:
GH_TOKEN: ${{ github.token }}
ACTIONABLE: ${{ steps.check.outputs.actionable }}
UNKNOWN: ${{ steps.check.outputs.unknown }}
HELD: ${{ steps.check.outputs.held }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
label=upstream-health
gh label create "$label" --color D93F0B \
--description "Upstream availability of external catalog entries" 2>/dev/null || true
{
echo "_Updated by [Upstream Health]($RUN_URL) on $(date -u +%Y-%m-%d)._"
echo
echo "Fix entries through a normal PR: repoint or remove \`gone\` entries, correct \`bad-*\` paths, and review upstream changes before bumping \`source.ref\` for \`outdated\` entries (rerun \`scripts/gen-collection-children.py\` for collections); a reviewed decision to keep the current pin can be recorded in \`<kind>/<id>/upstream-health-hold.json\`. \`unreachable\` means a network error, not a confirmed failure."
echo
cat report.md
} > body.md
issue=$(gh issue list --label "$label" --state open --limit 1 --json number --jq '.[0].number // empty')
if [ "$ACTIONABLE" = "true" ] || [ "$UNKNOWN" = "true" ]; then
if [ -n "$issue" ]; then
gh issue edit "$issue" --body-file body.md
else
gh issue create --title "Upstream health report" --label "$label" --body-file body.md
fi
elif [ -n "$issue" ]; then
closing="All external entries resolve upstream and are current as of $RUN_URL."
if [ "${HELD:-0}" -gt 0 ]; then
closing="All external entries resolve upstream as of $RUN_URL; $HELD finding(s) remain under reviewed holds (see the run summary)."
fi
gh issue comment "$issue" --body "$closing Closing."
gh issue close "$issue"
fi
- 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