Auto-commit after successful build: improve build setup

Changed files:\nSetupBuildEnvironment.sh
This commit is contained in:
Joe Tretter
2026-04-21 21:32:38 -05:00
parent 45e2452015
commit 0736c54a38

View File

@@ -75,10 +75,27 @@ auto_commit_if_needed() {
return return
fi fi
local changed_files
changed_files="$(git -C "$PROJECT_DIR" diff --cached --name-only)"
local -a summary_parts=()
if printf '%s\n' "$changed_files" | grep -q '^app/src/main/java/'; then
summary_parts+=("update app gameplay/UI")
fi
if printf '%s\n' "$changed_files" | grep -Eq '^(SetupBuildEnvironment\.sh|gradle\.properties|gradle/|gradlew|gradlew\.bat|build\.gradle\.kts|settings\.gradle\.kts|app/build\.gradle\.kts)'; then
summary_parts+=("improve build setup")
fi
if printf '%s\n' "$changed_files" | grep -Eq '^(README\.md|\.gitignore)$'; then
summary_parts+=("update docs/config")
fi
if [ ${#summary_parts[@]} -eq 0 ]; then
summary_parts+=("project updates")
fi
local commit_message local commit_message
commit_message="Auto-commit after successful build ($(date '+%Y-%m-%d %H:%M:%S'))" commit_message="Auto-commit after successful build: $(printf '%s, ' "${summary_parts[@]}" | sed 's/, $//')"
log "Creating git commit for the latest successful build" log "Creating git commit for the latest successful build"
git -C "$PROJECT_DIR" commit -m "$commit_message" git -C "$PROJECT_DIR" commit -m "$commit_message" -m "Changed files:\n$changed_files"
} }
download_if_missing() { download_if_missing() {