Skip to content

[action-required-reviewers] Unable to request reviews if one of the reviewers is a bot #37058

Closed

Description

@wagenet

Impacted plugin

None / Other

Quick summary

When using action-required-reviewers a bot can be specified as a reviewer (e.g. @renovate-approve[bot]). However, this won't work with request-reviews: true. This is because the bot is not a repository collaborator and review cannot be requested from collaborators. Ideally, we'd be able to still request reviews from the other non-bot users.

Steps to reproduce

Run Automattic/action-required-review
  with:
    token: ***
    requirements:
       - name: Dependencies
    paths:
      - '**/*'
    teams: [{"all-of":["web-frameworks"]},"@renovate-approve[bot]"]
    status: Require Approvals
    request-reviews: true
    fail: false

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

No response

What actually happened

Error: Unable to request review.
  Error: HttpError: Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the soxhub/auditboard-frontend repository.
Error: Unable to request review.
  Error: HttpError: Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the [SNIP] repository.
    at requestReviewer (/home/runner/_work/_actions/Automattic/action-required-review/93a995cac9308b74ef0c91c0d3ee8ded6bb9c2fe/webpack:/required-review/src/request-review.js:36:1)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at main (/home/runner/_work/_actions/Automattic/action-required-review/93a995cac9308b74ef0c91c0d3ee8ded6bb9c2fe/webpack:/required-review/src/main.js:101:1)

Impact

One

Available workarounds?

There is no user impact

Platform (Simple and/or Atomic)

No response

Logs or notes

No response

Activity

  1. added
    Bug
    Needs triage
    on Apr 24, 2024
  2. added and removed
    Needs triage
    on Apr 24, 2024
  3. anomiex commented on Apr 25, 2024

    @anomiex
    Contributor

    At a quick glance, probably the simplest thing would be to skip entries that both start with @ and end with [bot] in this loop

    for ( const t of teams ) {
    if ( t.startsWith( '@' ) ) {
    userReviews.push( t.slice( 1 ) );
    } else {
    teamReviews.push( t );
    }
    }

    There's an API endpoint to directly check if a user is a collaborator, but my first impression is that that's probably overkill unless the suffix check turns out to be insufficient. API calls are rate limited, after all.

    If you want to make a PR I'll review it, otherwise I'll try to find a chance to do that myself later.

  4. github-actions commented on Oct 23, 2024

    @github-actions
    Contributor

    This issue has been marked as stale. This happened because:

    • It has been inactive for the past 6 months.
    • It hasn’t been labeled `[Pri] BLOCKER`, `[Pri] High`, `[Type] Feature Request`, `[Type] Enhancement`, `[Type] Janitorial`, `Good For Community`, `[Type] Good First Bug`, etc.

    No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugTriaged[Action] Required Review[Pri] Low

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions