diff --git a/.github/workflows/pr-approvals.yaml b/.github/workflows/pr-approvals.yaml index 84b4b3a5dff..fbc86b6ecc8 100644 --- a/.github/workflows/pr-approvals.yaml +++ b/.github/workflows/pr-approvals.yaml @@ -5,6 +5,7 @@ name: PR Approval Check "on": pull_request: + types: [opened, synchronize, reopened, edited, auto_merge_enabled, auto_merge_disabled] branches: [main] jobs: @@ -42,3 +43,18 @@ jobs: fi fi + check_try: + runs-on: ubuntu-latest + steps: + - uses: octokit/request-action@v2.x + id: check_approvals + with: + route: GET /repos/${{ github.repository }}/pulls/${{ github.event.review.number }}/reviews + env: + GITHUB_TOKEN: ${{ github.token }} + - id: test_variables + run: | + JSON_RESPONSE='${{ steps.check_approvals.outputs.data }}' + CURRENT_APPROVALS_COUNT=$(echo $JSON_RESPONSE | jq -c '[.[] | select(.state | contains("APPROVED")) ] | length') + + echo "Current approvals count: $CURRENT_APPROVALS_COUNT"