Skip to content

Commit

Permalink
altered PR check function to only look at most recent PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeGordon83 committed Nov 19, 2024
1 parent c0eedc7 commit dbe2503
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ jobs:
function prCheck () {
REPO=$1
BASE=$2
STATE=$(gh pr list --repo $GITHUB_REPOSITORY_OWNER/$REPO --json title,mergeStateStatus,state,reviews --state OPEN --base $BASE --head $RELEASE_BRANCH --jq '.[] | select(.mergeStateStatus == "CLEAN" and .reviews[].state == "APPROVED") | .reviews[].state ')
STATE=$(gh pr list --repo $GITHUB_REPOSITORY_OWNER/$REPO --json title,mergeStateStatus,state,reviews \
--state OPEN --base $BASE --head $RELEASE_BRANCH \
--jq '.[] | select(.mergeStateStatus == "CLEAN") | .reviews | max_by(.submittedAt) | .state')
if [ "$STATE" != "APPROVED" ]; then
echo "Error: PR for merging $GITHUB_REPOSITORY_OWNER/$REPO $RELEASE_BRANCH into $BASE needs to be ready to merge and approved. (STATE=$STATE)" >&2
exit 1
Expand Down

0 comments on commit dbe2503

Please sign in to comment.