fix: detect merge commits, add API connectivity test in CI
All checks were successful
CodeAnt AI Review - Stage 1 / codeant-review (push) Successful in 1m16s

This commit is contained in:
WDI-Ideas
2026-03-30 03:12:52 +05:30
parent 8a554b9c07
commit bc80675ddd

View File

@@ -43,6 +43,16 @@ jobs:
echo "Base URL: $(codeant get-base-url)"
echo "CLI version: $(codeant --version)"
echo "=== API connectivity test ==="
HTTP_CODE=$(curl -s -o /tmp/api_response.txt -w "%{http_code}" \
-H "Authorization: Bearer ${CODEANT_API_KEY:-}" \
-H "Content-Type: application/json" \
https://service.codeant.ai/health 2>/dev/null || echo "CURL_FAILED")
echo "HTTP status: $HTTP_CODE"
head -c 200 /tmp/api_response.txt || true
env:
CODEANT_API_KEY: ${{ secrets.CODEANT_API_TOKEN }}
- name: Debug Commit Info
run: |
echo "==== EVENT CONTEXT ===="
@@ -56,12 +66,28 @@ jobs:
echo "==== FILES IN LAST COMMIT ===="
git show --name-only --pretty="" HEAD
echo "==== IS MERGE COMMIT ===="
PARENTS=$(git log -1 --format="%P" HEAD | wc -w)
echo "Parent count: $PARENTS"
if [ "$PARENTS" -gt 1 ]; then
echo "HEAD is a merge commit"
git log --oneline HEAD~1..HEAD --first-parent || true
fi
- name: Run CodeAnt Review
run: |
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ] && [ -n "${GITHUB_BASE_REF}" ]; then
echo "Running PR review against base: ${GITHUB_BASE_REF}"
echo "Running PR review against base branch: ${GITHUB_BASE_REF}"
codeant review --base "${GITHUB_BASE_REF}" 2>&1 | tee review.txt || true
else
echo "Running last-commit review"
# For push to main: check if HEAD is a merge commit
PARENTS=$(git log -1 --format="%P" HEAD | wc -w)
if [ "$PARENTS" -gt 1 ]; then
# Merge commit: review everything brought in by the merge (HEAD vs first parent)
echo "Merge commit detected - reviewing changes vs HEAD~1"
codeant review --base-commit HEAD~1 2>&1 | tee review.txt || true
else
echo "Regular push - reviewing last commit"
codeant review --last-commit 2>&1 | tee review.txt || true
fi
fi