policy-bot icon indicating copy to clipboard operation
policy-bot copied to clipboard

Exclude other files which are not mentioned in the

Open satizzzzz opened this issue 10 months ago • 1 comments

Hi, I have below policy with changed files path & ignore. Here i have defined every folders in the repo except backend and frontend folder changes. In future, there may any new files/folders will be added.

Is there any options to have some wildcard(or anything else) exclude everything except the ones which mentioned in the paths?

policy:
  approval:
    - or:
      - main rule 1
      
approval_rules:
  - name: main rule 1
    if:
      from_branch:
        pattern: "^hotfix/.*$"
      targets_branch:
        pattern: "^main$"
      changed_files:
        paths:
          - "^backend/.*$"
          - "^frontend/.*$"
        ignore:
          - "^.github/.*$"
          - "^config/special\\.file$"
          - "^argocd/.*$"
          - "^plat-eng/.*$"
          - "^docs/.*$"
          - "^scripts/.*$"
          - "^solutions/.*$"
          - "^terraform/.*$"

satizzzzz avatar Apr 07 '25 07:04 satizzzzz

In your example, the ignore patterns are not doing anything. The changed_files rule only considers changes in files matching the patterns in the paths key and ignores all other changes in the PR. The ignore key is useful if there were specific directories within the frontend/ or backend directories that should not be considered.

bluekeyes avatar Apr 08 '25 23:04 bluekeyes