diff --git a/README.md b/README.md index fc837bbb..37289112 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,14 @@ jobs: - name: Dependabot metadata id: dependabot-metadata uses: dependabot/fetch-metadata@v1.3.0 - - name: Approve a PR - run: gh pr review --approve "$PR_URL" + - uses: actions/checkout@v3 + - name: Approve a PR if not already approved + run: | + gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status` + if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; + then gh pr review --approve "$PR_URL" + else echo "PR already approved, skipping additional approvals to minimize emails/notification noise."; + fi env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}