ci: add verbose logging to auto-merge workflow #13
@ -48,15 +48,26 @@ jobs:
|
||||
API_BASE="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${PR_NUMBER}"
|
||||
|
||||
# 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 "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
|
||||
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 "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."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user