Actualiser gitea_push/scripts/smart_commit.sh
This commit is contained in:
@@ -1,28 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
SCOPE="plugin"
|
||||
elif echo "$CHANGED_FILES" | grep -q "skill"; then
|
||||
SCOPE="skill"
|
||||
elif echo "$CHANGED_FILES" | grep -q "agent"; then
|
||||
SCOPE="agent"
|
||||
else
|
||||
FIRST_FILE=$(echo "$CHANGED_FILES" | head -n 1)
|
||||
if [[ "$FIRST_FILE" == */* ]]; then
|
||||
SCOPE="${FIRST_FILE%%/*}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Determine description
|
||||
DESC=""
|
||||
# Description (FR)
|
||||
if [[ "$TYPE" == "docs" ]]; then
|
||||
DESC="update documentation"
|
||||
DESC="mise à jour de la documentation"
|
||||
elif [[ "$TYPE" == "test" ]]; then
|
||||
DESC="update tests"
|
||||
DESC="mise à jour des tests"
|
||||
elif [[ "$TYPE" == "chore" ]]; then
|
||||
DESC="update dependencies"
|
||||
DESC="mise à jour des dépendances"
|
||||
elif [[ "$TYPE" == "fix" ]]; then
|
||||
DESC="correction"
|
||||
elif [[ "$TYPE" == "refactor" ]]; then
|
||||
DESC="refactorisation"
|
||||
else
|
||||
FILE_COUNT=$(echo "$CHANGED_FILES" | wc -l | tr -d ' ')
|
||||
DESC="update ${FILE_COUNT} file(s)"
|
||||
DESC="mise à jour de ${FILE_COUNT} fichier(s)"
|
||||
fi
|
||||
|
||||
|
||||
@@ -34,20 +27,20 @@ fi
|
||||
fi
|
||||
|
||||
|
||||
info "Commit message: $COMMIT_MSG"
|
||||
info "Message de commit : $COMMIT_MSG"
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Commit
|
||||
# -----------------------------
|
||||
info "Creating commit..."
|
||||
git commit -m "$COMMIT_MSG" -m "Generated with Claude Code" -m "Co-Authored-By: Claude <noreply@anthropic.com>"
|
||||
info "Création du commit…"
|
||||
git commit -m "$COMMIT_MSG" -m "Généré avec Claude Code" -m "Co-Authored-By: Claude <noreply@anthropic.com>"
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Push
|
||||
# -----------------------------
|
||||
info "Pushing to remote '$REMOTE_NAME'..."
|
||||
info "Push vers '$REMOTE_NAME'…"
|
||||
|
||||
|
||||
if git ls-remote --exit-code --heads "$REMOTE_NAME" "$BRANCH" >/dev/null 2>&1; then
|
||||
@@ -57,15 +50,14 @@ git push -u "$REMOTE_NAME" "$BRANCH"
|
||||
fi
|
||||
|
||||
|
||||
info "Push complete"
|
||||
info "Push terminé"
|
||||
echo "$DIFF_STAT"
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Gitea PR link (best-effort)
|
||||
# Lien PR Gitea (best-effort)
|
||||
# -----------------------------
|
||||
# For Gitea, creating a PR is usually:
|
||||
# https://host/owner/repo/compare/<branch>?expand=1
|
||||
# Format courant : https://host/owner/repo/compare/<branch>?expand=1
|
||||
|
||||
|
||||
REMOTE_URL=$(git remote get-url "$REMOTE_NAME" 2>/dev/null || true)
|
||||
@@ -94,8 +86,7 @@ PATH_REPO="${HP#*|}"
|
||||
PATH_REPO="${PATH_REPO%.git}"
|
||||
|
||||
|
||||
# If configured host matches (or no configured host)
|
||||
if [[ -z "${GITEA_HOST:-}" || "$HOST" == "$GITEA_HOST" ]]; then
|
||||
warn "Create PR: https://${HOST}/${PATH_REPO}/compare/${BRANCH}?expand=1"
|
||||
warn "Créer une PR : https://${HOST}/${PATH_REPO}/compare/${BRANCH}?expand=1"
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user