Skip to content

Approve gets re-requested occasionally #403

Open
@vojvodics

Description

@vojvodics

Describe the bug

I'm unsure if this is a bug with our config, or in gitstream.
We have a rule to require multiple approves if the PR is > than some estimated time. And also a rule that automatically assigns a review for a person based on the files changed and who created a PR:

  complex_review:
    if:
      - {{ calc.etr >= 5 }}
    run:
      - action: set-required-approvals@v1
        args:
          approvals: {{ 3 if (calc.etr >= 10) else 2 }}

  {% for item in teams %}
  assign_reviewer_files_{{ loop.index }}:
    if:
      - {{ files | match(list=item.files) | some }}
      - {{ item.team_members | reject(term=pr.author) | reject(list=pr.reviewers) | length >= 1 }}
    run:
      - action: add-reviewers@v1
        args:
          reviewers: {{ item.team_members | reject(term=pr.author) | reject(list=pr.reviewers) }}
  {% endfor %}

  {% for item in teams %}
  assign_team_reviewer_{{ loop.index }}:
    if:
      - {{ item.team_members | includes(term=pr.author) }}
      - {{ item.team_members | reject(term=pr.author) | reject(list=pr.reviewers) | length >= 1 }}
    run:
      - action: add-reviewers@v1
        args:
          reviewers: {{ item.team_members | reject(term=pr.author) | reject(list=pr.reviewers) }}
  {% endfor %}

// reject is added because gitstream would fail if it required a review from a person that created a PR and also codeowners who github adds automatically.

The issue doesn't occur on every PR, but sometimes if the PR is >= 10min, gitstream bot re-requests a review from the last person that approved the PR:

image

image

This causes the approve to never be accepted and an infinite loop.

To Reproduce

Provided above, not sure if I can create a reproduction as it requires a bit more complex setup than usual

Expected behavior

Approve shouldn't be re-requested

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working👀.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions