ci: remove approval step from auto-merge workflow
All checks were successful
Auto-merge docs-only PRs / auto-merge-docs (pull_request) Successful in 2s
All checks were successful
Auto-merge docs-only PRs / auto-merge-docs (pull_request) Successful in 2s
Approval fails with "approve your own pull is not allowed" since the token belongs to the repo owner. Merge works without it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
230a35b8dd
commit
bc99bcdf4d
@ -39,7 +39,7 @@ jobs:
|
|||||||
|
|
||||||
echo "docs_only=${DOCS_ONLY}" >> "$GITHUB_OUTPUT"
|
echo "docs_only=${DOCS_ONLY}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Approve and merge
|
- name: Auto-merge
|
||||||
if: steps.check.outputs.docs_only == 'true'
|
if: steps.check.outputs.docs_only == 'true'
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.AUTO_MERGE_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.AUTO_MERGE_TOKEN }}
|
||||||
@ -47,27 +47,9 @@ jobs:
|
|||||||
PR_NUMBER=${{ github.event.pull_request.number }}
|
PR_NUMBER=${{ github.event.pull_request.number }}
|
||||||
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
|
curl -sf -X POST "${API_BASE}/merge" \
|
||||||
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 '{"Do": "merge", "merge_message_field": "Auto-merge: docs-only PR #'"${PR_NUMBER}"'"}'
|
||||||
echo "$APPROVE_RESP"
|
|
||||||
|
|
||||||
# Merge the PR
|
echo "PR #${PR_NUMBER} auto-merged."
|
||||||
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}"'"}')
|
|
||||||
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