Merge pull request 'ci: add verbose logging to auto-merge workflow' (#13) from fix/auto-merge-logging into main

Reviewed-on: #13
This commit is contained in:
cal 2026-03-19 04:39:59 +00:00
commit 20d51de72b

View File

@ -48,15 +48,26 @@ jobs:
API_BASE="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${PR_NUMBER}" API_BASE="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${PR_NUMBER}"
# Approve the PR # Approve the PR
curl -sf -X POST "${API_BASE}/reviews" \ echo "Approving PR #${PR_NUMBER}..."
APPROVE_RESP=$(curl -s -w "\nHTTP_%{http_code}" -X POST "${API_BASE}/reviews" \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"event": "APPROVED", "body": "Auto-approved: docs-only changes (all .md files)."}' -d '{"event": "APPROVED", "body": "Auto-approved: docs-only changes (all .md files)."}')
echo "$APPROVE_RESP"
# Merge the PR # Merge the PR
curl -sf -X POST "${API_BASE}/merge" \ echo "Merging PR #${PR_NUMBER}..."
MERGE_RESP=$(curl -s -w "\nHTTP_%{http_code}" -X POST "${API_BASE}/merge" \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"Do": "merge", "merge_message_field": "Auto-merge: docs-only PR #'"${PR_NUMBER}"'"}' -d '{"Do": "merge", "merge_message_field": "Auto-merge: docs-only PR #'"${PR_NUMBER}"'"}')
echo "$MERGE_RESP"
# Check for failure
HTTP_CODE=$(echo "$MERGE_RESP" | tail -1)
if [[ "$HTTP_CODE" =~ HTTP_4[0-9][0-9] || "$HTTP_CODE" =~ HTTP_5[0-9][0-9] ]]; then
echo "Merge failed!"
exit 1
fi
echo "PR #${PR_NUMBER} auto-approved and merged." echo "PR #${PR_NUMBER} auto-approved and merged."