fix: fall back to CI bot token for auto-merge approval
CI / validate (pull_request) Successful in 1m5s
CI / auto-merge (pull_request) Successful in 27s

REVIEWER_GITEA_API_TOKEN is the same user as the PR creator, causing
self-approval rejection. Now tries REVIEWER first, then falls back to
CI_GITEA_API_TOKEN (kireto — CI bot account).

Closes DEVX-161

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
emil
2026-08-26 09:55:27 +02:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent 48122876ba
commit c3d1f630db
2 changed files with 47 additions and 7 deletions
+27
View File
@@ -0,0 +1,27 @@
# DEVX-161: Fix auto-merge self-approval: use CI bot token fallback
## Problem
The auto-merge workflow posts an APPROVE review using
`REVIEWER_GITEA_API_TOKEN`. When this token belongs to the same user
who created the PR, Gitea rejects the self-approval, causing the merge
to fail with HTTP 405 "Does not have enough approvals."
## Approach
Try `REVIEWER_GITEA_API_TOKEN` first; if it fails (self-approval
rejection), fall back to `CI_GITEA_API_TOKEN` (kireto — CI bot account).
REQ-1: Auto-merge posts approval with fallback to CI bot token
REQ-2: Approval step reports which token succeeded
## Test Plan
- Create a PR and observe auto-merge succeeds
## Deploy Plan
- Merge to master
## Rollback Plan
- Revert the merge commit
## Acceptance Criteria
- [x] REQ-1: Auto-merge posts approval with fallback to CI bot token
- [x] REQ-2: Approval step reports which token succeeded