Actualiser gitea_push/scripts/smart_commit.sh

This commit is contained in:
2026-01-19 20:52:08 +01:00
parent 4289770786
commit 5a023806b9

View File

@@ -1,28 +1,21 @@
#!/usr/bin/env bash #!/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 fi
# Determine description # Description (FR)
DESC=""
if [[ "$TYPE" == "docs" ]]; then if [[ "$TYPE" == "docs" ]]; then
DESC="update documentation" DESC="mise à jour de la documentation"
elif [[ "$TYPE" == "test" ]]; then elif [[ "$TYPE" == "test" ]]; then
DESC="update tests" DESC="mise à jour des tests"
elif [[ "$TYPE" == "chore" ]]; then 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 else
FILE_COUNT=$(echo "$CHANGED_FILES" | wc -l | tr -d ' ') FILE_COUNT=$(echo "$CHANGED_FILES" | wc -l | tr -d ' ')
DESC="update ${FILE_COUNT} file(s)" DESC="mise à jour de ${FILE_COUNT} fichier(s)"
fi fi
@@ -34,20 +27,20 @@ fi
fi fi
info "Commit message: $COMMIT_MSG" info "Message de commit : $COMMIT_MSG"
# ----------------------------- # -----------------------------
# Commit # Commit
# ----------------------------- # -----------------------------
info "Creating commit..." info "Création du commit"
git commit -m "$COMMIT_MSG" -m "Generated with Claude Code" -m "Co-Authored-By: Claude <noreply@anthropic.com>" git commit -m "$COMMIT_MSG" -m "Généré avec Claude Code" -m "Co-Authored-By: Claude <noreply@anthropic.com>"
# ----------------------------- # -----------------------------
# Push # 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 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 fi
info "Push complete" info "Push terminé"
echo "$DIFF_STAT" echo "$DIFF_STAT"
# ----------------------------- # -----------------------------
# Gitea PR link (best-effort) # Lien PR Gitea (best-effort)
# ----------------------------- # -----------------------------
# For Gitea, creating a PR is usually: # Format courant : https://host/owner/repo/compare/<branch>?expand=1
# https://host/owner/repo/compare/<branch>?expand=1
REMOTE_URL=$(git remote get-url "$REMOTE_NAME" 2>/dev/null || true) REMOTE_URL=$(git remote get-url "$REMOTE_NAME" 2>/dev/null || true)
@@ -94,8 +86,7 @@ PATH_REPO="${HP#*|}"
PATH_REPO="${PATH_REPO%.git}" PATH_REPO="${PATH_REPO%.git}"
# If configured host matches (or no configured host)
if [[ -z "${GITEA_HOST:-}" || "$HOST" == "$GITEA_HOST" ]]; then 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
fi fi