[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
- Configure the
Automattic/action-required-review
action withrequest-reviews: true
. - Make a PR where the author is also a required reviewer as defined in the action config.
- 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
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
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.