Files
KomhandClaude Opus 5 6bc2c7632d fix(ci): give delist-prune a full checkout so listing dates survive (#266)
delist-prune rebuilds and redeploys the whole site, but its checkout used
the default depth of 1. In a shallow clone `git log --diff-filter=A` reports
every registry/<id>/ as added by the single grafted commit, so enrich.mjs
stamped one identical `added` on every app. The homepage sorts by `added`
over a list loadApps() already sorted by name, so an all-equal key left the
stable sort untouched and "Recently added" silently became alphabetical
(same for "Recently updated" on apps with no upstream release date). Last
seen live after the 2026-08-26 delist-prune dispatch landed on top of a
correct publish.

- delist-prune checks out with fetch-depth: 0, like publish already does.
- enrich.mjs refuses to run in a shallow clone rather than emitting a
  catalog with a dead sort key; FLATPARK_ALLOW_SHALLOW=1 opts out.
- check-links.sh sets that opt-out: it only wants the URLs, and
  link-check.yml runs at the default depth.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-08-27 05:26:42 +08:00

32 lines
1010 B
Bash
Executable File

#!/usr/bin/env bash
# Regenerate app data, then batch-check every external URL the site hotlinks.
# Exits non-zero if any link is broken. Usage:
# scripts/check-links.sh [--json] [app-id ...]
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$ROOT/scripts/lib/common.sh"
load_config "$ROOT"
need node
: "${SITE_DIR:=$ROOT/site}"
json=""
appids=()
for a in "$@"; do
case "$a" in
--json) json="--json" ;;
*) appids+=("$a") ;;
esac
done
"$ROOT/scripts/gen-apps-json.sh" ${appids[@]+"${appids[@]}"}
if [ ! -d "$SITE_DIR/node_modules" ]; then
need npm
( cd "$SITE_DIR" && npm install --no-audit --no-fund )
fi
# Link checking only needs the URLs enrichment pulls out of the metainfo; the
# git listing dates it also computes are irrelevant here, so a shallow checkout
# (link-check.yml uses the default depth) is fine and must not be rejected.
( cd "$SITE_DIR" && FLATPARK_ALLOW_SHALLOW=1 node tools/enrich.mjs )
( cd "$SITE_DIR" && node tools/check-links.mjs $json )