Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.

Home Page:https://jetpack.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[action-required-review] request review fails when required reviewer is PR author

evan-gray opened this issue · comments

Impacted plugin

None / Other

Quick summary

When request-reviews: true is set on the action and a pull request author is also one of the required reviewers, the action attempts to request review from the pull request author which is not allowed by GitHub and results in the following error.

Error: Unable to request review.
  Error: HttpError: Review cannot be requested from pull request author.

Steps to reproduce

  1. Configure the Automattic/action-required-review action with request-reviews: true.
  2. Make a PR where the author is also a required reviewer as defined in the action config.
  3. The action will fail.

A clear and concise description of what you expected to happen.

The action should not fail. The action should remove the author from the list of reviewers it will request.

What actually happened

The action fails 😢

Impact

Some (< 50%)

Available workarounds?

No but the platform is still usable

Platform (Simple and/or Atomic)

No response

Logs or notes

https://github.com/wormholelabs-xyz/required-review-test/actions/runs/9294538462/job/25579868854?pr=2

In your fix, you're skipping the required review when the required reviewer is the PR author. On one hand that makes sense. On the other, I wonder if it wouldn't be best to avoid those scenarios altogether by having a fallback reviewer (team or person)?

I don't think it would be worth adding logic for an actual "fallback" (i.e. "X, or Y only if X is the author") versus just configuring the action with "any-of: X, Y". That would also handle situations like when X is on vacation.

The fix looks ok to me, although I might instead do the check against author at

while processing the array instead of pre-filtering the array.

If you'd make a PR against the file linked above in this repo, we can get it reviewed and merged.

@anomiex I had considered that but then the message Requested review(s) from... would include the name of the skipped author. Also concur that fallback does not feel necessary as there, ideally, should be redundancy in a reviewer list. Though it is interesting that CODEOWNERS just allows any reviewers if the sole owner is also the PR author 🤷

Will open a PR, just wasn't sure if other changes were necessary given the mirror repo setup.

I had considered that but then the message Requested review(s) from... would include the name of the skipped author.

Good point, I missed that.

Awesome, thanks for the assist @anomiex 🤝