Skip to content

AI Code Review: User matching not working #747

@echarrod

Description

@echarrod

Describe the bug

I'm looking at https://docs.gitstream.cm/context-variables/#pr, and trying to run this config for AI code review:

manifest:
  version: 1.0

config:
  ignore_files:
    - 'go.sum'
    - 'go.work.sum'
    - '*.pb.go'
    - '*.pb.gw.go'
    - 'bin/**'
    - 'static/**'
    - 'blobs/**'

automations:
  # AI code review for new changes
  linearb_ai_review:
    if:
      - {{ not pr.draft }}
      - {{ not is.bot }}
    run:
      - action: code-review@v1
        args:
          approve_on_LGTM: {{ approve_pr_on_lgtm }} # optional arg, you can remove it
          guidelines: {{ guidelines }}

# Define variables
# Add conditions for PR approvals. For example - allow approval only for specific users
approve_pr_on_lgtm: false

# Custom expressions for bot detection
is:
  bot: >-
    {{ pr.author | match(list=[
        '_bot', 
        '[bot]', 
        'project_35771297_bot_558e119f0f4d33f2fc8b315e66d53c86', 
        'group_14117954_bot_085a90599cd4653c9aa736ce6538ae23', 
        'project_35771297_bot_3baa505335b81595ea1f502563700a41'
    ]) | some }}

# Add `guidelines` to add your prompts to the review, you can have org wide instructions
# by placing the `REVIEW_RULES.md` in the `cm` repo or team level instructions by adding it to
# the team repo.
# Note: To when the file is in the `cm` repo, use this example: `../cm/REVIEW_RULES.md`
guidelines: {{ "./.cm/REVIEW_RULES.md" | readFile() | dump }}

But my not is.bot checks don't seem to be ignoring bot users, e.g. https://gitlab.com/group_14117954_bot_085a90599cd4653c9aa736ce6538ae23

I don't see that this is only restricted to GitHub on the docs, but does it perform differently in GitLab?

After this failed, I also tried to:

  1. Use branch.author (as I thought pr.author might be GitHub-specific), but still seem to be suffering from the same problem
  2. Put a @ before the user names, in case it was looking for those

Expected behavior

  • These bot MRs should be ignored, and not reviewed by AI code review

Screenshots

Image

Additional context

  • Running on self-hosted GitLab instance, using image index.docker.io/gitstream/rules-engine:1.0.130

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