New context: hugo-content-workspace/v1
- init.sh: clones hugo-{customer}-content at HUGO_CONTENT_BRANCH and
hugo-{customer}-integration at main via gitea-ssh-accelerators
- finalize.sh: detects changes, commits content repo first then
integration repo; skips silently if no changes
- CLAUDE.md: instructs the agent to work in /workspace/content/
New composite: hugo-content-airouter/v1
- Combines airouter/v1 + gitea-ssh-accelerators/v1 + hugo-content-workspace/v1
- Label-gated to airouter dispatchers (ESO secret required)
Used by cms-proxy /ai/{customer}/draft endpoint.
56 lines
1.6 KiB
Bash
Executable File
56 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# hugo-content-workspace/v1 finalize.sh
|
|
# Detects and commits any changes made by the agent.
|
|
# Content repo is committed and pushed first, then integration repo.
|
|
set -euo pipefail
|
|
|
|
echo "=== hugo-content-workspace/v1 finalize.sh ==="
|
|
|
|
: "${HUGO_CUSTOMER:?HUGO_CUSTOMER is required}"
|
|
: "${HUGO_CONTENT_BRANCH:=staging}"
|
|
|
|
commit_repo() {
|
|
local repo_dir="$1"
|
|
local branch="$2"
|
|
local label="$3"
|
|
|
|
if [ ! -d "${repo_dir}/.git" ]; then
|
|
echo "${label}: no .git directory, skipping"
|
|
return 0
|
|
fi
|
|
|
|
cd "${repo_dir}"
|
|
|
|
# Check for any modifications (tracked or untracked)
|
|
if git diff --quiet HEAD 2>/dev/null && [ -z "$(git ls-files --others --exclude-standard)" ]; then
|
|
echo "${label}: no changes detected"
|
|
return 0
|
|
fi
|
|
|
|
# Stage all changes
|
|
git add -A
|
|
|
|
# Double-check — after staging, is there anything to commit?
|
|
if git diff --cached --quiet; then
|
|
echo "${label}: nothing staged after add -A"
|
|
return 0
|
|
fi
|
|
|
|
local msg="AI content update — ${HUGO_CUSTOMER} (${HUGO_CONTENT_BRANCH})"
|
|
if [ "${label}" = "integration" ]; then
|
|
msg="AI integration update — ${HUGO_CUSTOMER}"
|
|
fi
|
|
|
|
git commit -m "${msg}"
|
|
git push origin "${branch}"
|
|
echo "${label}: committed and pushed to ${branch}"
|
|
}
|
|
|
|
# 1. Content repo — push to the requested content branch
|
|
commit_repo /workspace/content "${HUGO_CONTENT_BRANCH}" "content"
|
|
|
|
# 2. Integration repo — push to main
|
|
commit_repo /workspace/integration "main" "integration"
|
|
|
|
echo "=== hugo-content-workspace/v1 finalize.sh complete ==="
|