dorny / paths-filter

Conditionally run actions based on files modified by PR, feature branch or pushed commits
MIT License
2.14k stars 239 forks source link

Is it possible to check if a single folder has changed? #207

Closed guy-frontegg closed 10 months ago

guy-frontegg commented 11 months ago

Hey,

Thank you very much for this action, it is great.

I have a question I could not find an answer to, is it possible to check if a file has change in a specific folder and nothing else in the repository?

for example: folder_A x.txt folder_B folder_C file.1 file.2

How to know if file X.txt is the only thing that changes in this commit and nothing else?

BTW the structure is not constant only the name of the folder itself

SethFalco commented 10 months ago

Your question is very unclear. It sounds like you want one of the following configurations, though.

This would match if only the contents of the directory or subdirectory named folder_A has changed:

- uses: dorny/paths-filter@v2
  with:
    filters: |
      src:
        - '**/folder_A/**'

This would match if the file x.txt changed, regardless of which directory it's found in:

- uses: dorny/paths-filter@v2
  with:
    filters: |
      src:
        - '**/x.txt'
guy-frontegg commented 10 months ago

Thank you for your answer, :) My question was let's say that I want to know if

- uses: dorny/paths-filter@v2
  with:
    filters: |
      src:
        - '**/x.txt'

and only this file and nothing else. But I found the answer so we can close this issue. Thank you