chore(deploy): skip production deploys for non-site commits

Netlify bills 15 credits per production deploy, and this cycle already spent
~315 on 21 deploys. auto-deploy.sh now skips when the change between the last
deployed SHA and origin/main touches only non-site files (AGENTS.md/*.md,
scripts/, cvm-server/, skills/) — it records the SHA without deploying, so doc
commits cost nothing.
This commit is contained in:
SkateSpots 2026-09-27 14:42:57 +07:00
parent 70440c4bce
commit 9d0c31f673

View file

@ -55,6 +55,19 @@ if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
exit 0
fi
# 2b. Skip when the change cannot affect the deployed site. Netlify bills 15
# credits per production deploy, so don't spend them on docs-only commits
# (AGENTS.md, NIP.md, scripts/, the standalone CVM server, etc.).
if [ -n "$LAST_SHA" ] && git cat-file -e "${LAST_SHA}^{commit}" 2>/dev/null; then
changed="$(git diff --name-only "$LAST_SHA" "$REMOTE_SHA" || true)"
site_affecting="$(printf '%s\n' "$changed" | grep -vE '^([^/]*\.md|scripts/|cvm-server/|skills/|\.agents/)' || true)"
if [ -n "$changed" ] && [ -z "$site_affecting" ]; then
log "origin/main moved to ${REMOTE_SHA:0:9} but only non-site files changed — skipping deploy (no credits spent)"
echo "$REMOTE_SHA" > "$SHA_FILE"
exit 0
fi
fi
# 3. Move the repo to the published commit (fast-forward only).
if [ "$(git rev-parse HEAD)" != "$REMOTE_SHA" ]; then
if git merge --ff-only --quiet origin/main; then