Remove label based on file paths

Here's an example of a Revy configuration that removes a label from a pull request that contains the proper changes based on the file path.

apiVersion: reviewpad.com/v0.0.4

labels:
  missing-tests:
    description: Change misses the test specification
    color: fd5e53

rules:
  codeChangesWithoutTests:
    kind: patch
    description: Changes to src and not to test files
    spec: $hasFilePattern("src/**") && !$hasFilePattern("*_test.go")
  codeChangesWithTests:
    kind: patch
    description: Changes to src and to test files
    spec: $hasFilePattern("src/**") && $hasFilePattern("*_test.go")

protectionGates:
  - name: requireTests
    description: Tests are required
    patchRules:
      - rule: codeChangesWithoutTests
    actions:
      - $addLabel("missing-tests")
  - name: clean
    description: Clean up process
    patchRules:
      - rule: codeChangesWithTests
    actions:
      - $removeLabel("missing-tests")

Did this page help you?