From 1c5eb524903b715bb2b46aa9d78d8cfb89b332ae Mon Sep 17 00:00:00 2001 From: Hugh Hackman Date: Sun, 22 Mar 2026 00:11:01 +0000 Subject: [PATCH] fix(ci): check last review state per user in dual-approval workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the jq logic checked if *any* review from CTO/QA had state == APPROVED. This allowed a PR to pass dual-approval even if the reviewer subsequently requested changes — because the earlier approval was still in the review history. Fix: filter reviews by user, take the last one, and check its state. This ensures a CHANGES_REQUESTED review after an approval correctly blocks the check. Co-Authored-By: Paperclip --- .github/workflows/dual-approval-check.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dual-approval-check.yaml b/.github/workflows/dual-approval-check.yaml index 6e90a84..324ce4a 100644 --- a/.github/workflows/dual-approval-check.yaml +++ b/.github/workflows/dual-approval-check.yaml @@ -56,10 +56,10 @@ jobs: REVIEWS=$(gh api "repos/${REPO}/pulls/${PR_NUMBER}/reviews" 2>&1) CTO_APPROVED=$(echo "${REVIEWS}" | jq -r --arg user "${CTO_REVIEWER}" \ - '[.[] | select(.user.login == $user and .state == "APPROVED")] | length > 0') + '[.[] | select(.user.login == $user)] | last | .state == "APPROVED"') QA_APPROVED=$(echo "${REVIEWS}" | jq -r --arg user "${QA_REVIEWER}" \ - '[.[] | select(.user.login == $user and .state == "APPROVED")] | length > 0') + '[.[] | select(.user.login == $user)] | last | .state == "APPROVED"') echo "CTO (${CTO_REVIEWER}) approved: ${CTO_APPROVED}" echo "QA (${QA_REVIEWER}) approved: ${QA_APPROVED}"