Skip to main content
Version: 3.16.0

Label based on file paths

Here's an example of a reviewpad.yml configuration that labels pull requests that contain changes to a certain filepath.

This is useful when we want to automatically assign a reviewer based on the files that were changed or label a pull request as critical when it contains changes to critical files.

api-version: reviewpad.com/v3.x

labels:
critical:
description: Critical changes
color: fd5e53

rules:
- name: changes-main-file
spec: $hasFileName("main.go")
- name: changes-config-file
spec: $hasFileName("config.yml")

workflows:
- name: critical
if:
- rule: changes-main-file
then:
- $addLabel("critical")
- name: configurations
if:
- rule: changes-config-file
then:
- $assignTeamReviewer(["devops"])