diff --git a/.github/workflows/pr-ai-review.yml b/.github/workflows/pr-ai-review.yml index 26878d7a1..c1e908a3e 100644 --- a/.github/workflows/pr-ai-review.yml +++ b/.github/workflows/pr-ai-review.yml @@ -18,7 +18,10 @@ permissions: jobs: authorize: runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request_target' + # explicitly require the PR to be open to avoid old events triggering a review on closed PRs: https://github.com/aws/agentcore-cli/issues/1463 + if: + github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request_target' && + github.event.pull_request.state == 'open') outputs: authorized: ${{ steps.auth.outputs.authorized }} steps: