From 2b91839a16db1280b14717df34298b28939ba665 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 9 Nov 2026 20:45:02 +0000 Subject: [PATCH] fix(automerge): count the review bot's two logins as one reviewer A change request from hansi-codes[bot] was never superseded once the app was renamed to appwrite[bot], so PRs the bot had since approved stayed blocked. --- .github/scripts/automerge.sh | 8 ++++++-- README.md | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/scripts/automerge.sh b/.github/scripts/automerge.sh index 9f00a39..6b8fa11 100755 --- a/.github/scripts/automerge.sh +++ b/.github/scripts/automerge.sh @@ -101,8 +101,12 @@ pr() { reviews=$(gh api --paginate --slurp "repos/$repository/pulls/$number/reviews?per_page=100" | jq '[.[][]]') # A reviewer's standing verdict is their latest approval, change request or dismissal; comments do not change it. - blocked=$(jq -r '[.[] | select(.state == "APPROVED" or .state == "CHANGES_REQUESTED" or .state == "DISMISSED")] - | group_by(.user.login) | map(last | select(.state == "CHANGES_REQUESTED") | .user.login) | join(", ")' <<< "$reviews") + # The review bot's logins are one reviewer, and every review of its is a verdict, so its latest one stands. + blocked=$(jq -r --arg bots "$BOTS" '($bots | split(" ")) as $bots + | [.[] | (.user.login as $login | $bots | index($login) != null) as $bot + | select(.state == "APPROVED" or .state == "CHANGES_REQUESTED" or .state == "DISMISSED" or ($bot and .state == "COMMENTED")) + | .reviewer = (if $bot then $bots[0] else .user.login end)] + | group_by(.reviewer) | map(last | select(.state == "CHANGES_REQUESTED") | .reviewer) | join(", ")' <<< "$reviews") if [ -n "$blocked" ]; then echo "$log: skip, changes requested by $blocked"; return fi diff --git a/README.md b/README.md index a4d1eb0..4096a1b 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The `automerge` workflow runs every 30 minutes and merges a Renovate PR only whe 1. The PR is authored by `renovate-appwrite[bot]`, open, not a draft, has no conflicts, and its repository is covered by the runner (the same exclusions, forks and split mirrors as `plan`). 2. CI passed: at least one check run or commit status exists (a repository without CI never auto-merges; skipped check runs and the verify workflow's `detect projects` job do not count), no check run is pending, every check run concluded success, skipped or neutral, and the combined commit status is success. Review bot check runs (Hansi, Tenki) are verdicts, not CI, so they are left out of this step and a non-S Hansi tier does not block a maintainer's approval. -3. It is approved: an `APPROVED` review on the head commit from the review bot (`appwrite[bot]`, formerly `hansi-codes[bot]`) or from a user with write, maintain or admin access, or the review bot's `Hansi` check reporting Tier S on the head commit. A major update, including a security fix that needs one, only counts a user's approval. No reviewer's latest review requests changes. +3. It is approved: an `APPROVED` review on the head commit from the review bot (`appwrite[bot]`, formerly `hansi-codes[bot]`) or from a user with write, maintain or admin access, or the review bot's `Hansi` check reporting Tier S on the head commit. A major update, including a security fix that needs one, only counts a user's approval. No reviewer's latest review requests changes; the review bot's two logins count as one reviewer, whose latest review of any kind stands. It then merges with the org's app token, squashing if the repository and its branch rulesets allow it, else with a merge commit, else by rebase, and passes `--match-head-commit` so a push in between stops the merge. Branch protection still applies: a refused merge is logged as a warning and retried on the next run. Every PR gets one log line with the decision and the reason.