Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If reviewers already assigned, skip #16

Open
brianeclow opened this issue Feb 14, 2020 · 11 comments · May be fixed by #23
Open

If reviewers already assigned, skip #16

brianeclow opened this issue Feb 14, 2020 · 11 comments · May be fixed by #23
Assignees

Comments

@brianeclow
Copy link

We are finding it annoying when a PR requester takes care to request specific people to review a PR, then the action comes along and adds more. A great flag would be to be able to skip adding reviews if the numberOfReviewers has been met or to skip adding reviews completely in this case.

@vistaar-dgada
Copy link

@brianeclow //cc @kentaro-m You're searching for action to run only once. Usually it runs on every push on PR. So i think this will take care of it.

name: 'Auto Assign'
on:
  pull_request:
    types: [opened, reopened]
jobs:
  add-reviews:
    runs-on: ubuntu-latest
    steps:
      - uses: kentaro-m/auto-assign-action@v1.0.1
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"

@brianeclow
Copy link
Author

Nope!
@vistaar-dgada That is not what I'm asking for at all. I already have the action run only once upon opening of the PR. I am looking for the action to be skipped if reviewers have already been set by someone when the PR was created. This means, the author has specific reviewers in mind, and adding new people confuses all involved.

If I am understanding correctly, the code can check the reviewer array, and act accordingly. And at that point, we could get options: no action taken, add reviewers from the pool to bring up to the desired total, add reviews from the pool, etc.
My ask is for at least no action and add users from pool.

@dsazup
Copy link

dsazup commented May 26, 2020

We are running into the same issue too. For example if I create a non-draft, normal PR it assigns 2 reviewers. Let's say I instantly mark that PR as draft. Now when I mark it ready for review again, it adds 2 more reviewers which is not really expected.

@PrinsFrank
Copy link

Because of reviewer amount limitations in private repos in orgs this also results in unassigning the current reviewer on every push action (or in case of only updating on open and reopen on every open/reopen action).

We're also running into the issue that when assigning a reviewer during creation of a PR it gets overwritten immediately by the action.

@PrinsFrank
Copy link

I just managed to work around it for now by adding a condition to the job like this:

name: 'Auto Assign'
on:
  pull_request:
    types: [opened, reopened]
jobs:
  add-reviews:
    if: github.event.pull_request.requested_reviewers.*.name == ''
    runs-on: ubuntu-latest
    steps:
      - uses: kentaro-m/auto-assign-action@v1.0.1
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"

@dsazup
Copy link

dsazup commented Jun 5, 2020

@PrinsFrank interesting, though doesn't seem to work for me. When I submit a PR, it just skips the action all together initially 🤔

@brianeclow
Copy link
Author

@PrinsFrank That does not work. I did several iterations around it, and github actions will not let you test an empty array in that fashion or in any way I could think of. This is final configuration I ended up with before stopping:

name: 'Auto Assign'
on:
  pull_request:
    types: [opened, reopened]

jobs:
  triage-assign-and-review:
    if: contains(github.event.pull_request.requested_reviewers.*.login, '') && contains(github.event.pull_request.requested_teams.*.slug, '')
    runs-on: ubuntu-latest
    steps:
      - uses: kentaro-m/auto-assign-action@v1.1.1
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"

@kentaro-m
Copy link
Owner

Hi, @brianeclow! Thanks for waiting.

I thought a good idea which checking exist assignees or reviewers before adding its to PR.

  1. Checking existed reviewers
    1. Skip the process to add reviewers if PR has reviewers
  2. Adding reviewers if no reviewers
  3. Checking existed assignees
    1. Skip the process to add assignees if PR has assignees
  4. Adding assignees if no assignees

I think it's better to control the skipping process as the logic of the application rather than the if syntax of the workflow.

If you have any concerns, please let me know.

@kentaro-m kentaro-m self-assigned this Jun 13, 2020
@carlisia
Copy link

carlisia commented Mar 12, 2021

I thought a good idea which checking exist assignees or reviewers before adding its to PR.

This sounds good to me. To be clear, it should precisely be checking that the "number" of reviewers/assignees match what's specified in the config file.

I'm having the same general problem, but specifically one no one has mentioned: I open a PR, the right number of (random) reviewers get added (good). Any subsequent commit pushed to that PR will trigger more reviewers being assigned (bad).

@idonov8
Copy link

idonov8 commented Apr 18, 2022

My team encountered this problem. Is there any up-to-date solution?
@carlisia is the problem fixed on the GitHub App version? Should we switch to using it?

@carlisia
Copy link

carlisia commented May 2, 2022

Hey @idonov8 I haven't tested or used this action in a long while, sorry I cannot be of help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants