diff --git a/.github/workflows/pr-approvals.yaml b/.github/workflows/pr-approvals.yaml index f5c0fd6c600..097bb83ad8f 100644 --- a/.github/workflows/pr-approvals.yaml +++ b/.github/workflows/pr-approvals.yaml @@ -25,11 +25,15 @@ jobs: echo "$BODY" | egrep -qsi '^disable-check:.*\' if [[ $? -ne 0 ]]; then # Get the list of modified files in this pull request - files=$(gh pr view $PR_NUMBER --json files --jq '.files.[].path') + files=$(gh pr view $PR_NUMBER --json files --jq '.files.[].path | select(startswith(".github") | not)') # Get the list of approvals in this pull request approvals=$(gh pr view $PR_NUMBER --json reviews --jq '[.reviews.[] | select(.authorAssociation == "MEMBER" and .state == "APPROVED")] | length') - if [[ $approvals -lt 2 ]] && echo "${files}" | grep -Eq "^.github"; then + gh pr view $PR_NUMBER --json reviews --jq '[.reviews.[] | select(.authorAssociation == "MEMBER" and .state == "APPROVED")] + + echo "Approvals: $approvals" + + if [[ $approvals -lt 2 ]] && [[ ! "${files}" ]] ; then echo "This pull request requires 2 approvals before merging." echo echo "For trivial changes, you may disable this check by adding this trailer to the pull request message:"