Don't let self-authored PRs break the BCR PR reviewer (#2904)
Fixes #2885
GitHub doesn't let you review your own PR. So when a BCR PR was opened
by @bazel-io (e.g. bazelbuild/bazel-central-registry#10700), the
`APPROVE` `createReview` call in `reviewPR` threw. The error also
escaped `runPrReviewer` and stopped the whole `review_prs` loop, which
meant no other open PRs got auto-reviewed either (e.g.
bazelbuild/bazel-central-registry#10699).
### Changes
- `reviewPR`: when the PR author is the authenticated bot account, the
reviewer doesn't call `createReview` (it skips both `APPROVE` and
`REQUEST_CHANGES`). If every module has its maintainers' approval, it
posts a comment (only once) and requests a review from `bcr-maintainers`
instead. It still tries to merge, so the PR gets merged on a later run
once a BCR maintainer approves.
- `runPrReviewer`: errors are caught per PR, so a failure on one PR no
longer blocks the rest. If any PR failed, the run is marked failed at
the end (`setFailed`) so the errors still show up.
- Export `reviewPR`/`runPrReviewer` and add unit tests for: the normal
approve+merge path, a self-authored PR, and one PR failing while the
loop keeps going.
### Testing
`cd actions/bcr-pr-reviewer && node --test`: all 12 tests pass.
Note: BCR workflows pin this action by SHA, so a follow-up BCR PR that
bumps the SHA is needed for this to take effect.
2 files changed