Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
svenklemm committed Oct 18, 2024
1 parent e73451c commit 578a14e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/pr-approvals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ jobs:
echo "$BODY" | egrep -qsi '^disable-check:.*\<approval-count\>'
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:"
Expand Down

0 comments on commit 578a14e

Please sign in to comment.