Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignoring some subfolders from filter #56

Closed
avolusb opened this issue Dec 14, 2020 · 5 comments
Closed

Ignoring some subfolders from filter #56

avolusb opened this issue Dec 14, 2020 · 5 comments
Labels
question Further information is requested

Comments

@avolusb
Copy link

avolusb commented Dec 14, 2020

Hello,
Thank you for developing this great tool, it very helpful in my current project.
But I have a little problem, I can't ignore folders which contain other folders, maybe your tool have some option to ignore folders from filter?
I mean a situation when folder system looks like:
Folder1:
Folder11
Folder12
Folder13

And I want to ignore for example Folder 12, but checking Folder13 and Folder11, maybe you know some solution for that case?

P.S. I'm trying to use 'ignore' option from micromath - '(BigFolder/**, {ignore: InsideFolder})', but it not works, filter just disabled and don't see any file changes :(

@dorny
Copy link
Owner

dorny commented Dec 15, 2020

Hello,

It should work this way: BigFolder/!(InsideFolder/**)/**
This will match everything inside BigFolder except all files under InsideFolder folder.
Please confirm if it works for you by closing this issue. Staring the repo will be also appreciated :)

P.S.: You can't use {ignore: InsideFolder} - this would have to be added to second argument when this action invokes the picomatch(glob, options). Using this action whatever you write inside filter will be used as the first glob argument.

@avolusb
Copy link
Author

avolusb commented Dec 15, 2020

Thank you for fast answer.
Great, this solved one part of my problem, the second part is: what I need to do if I want to ignore couple folders inside big folder?
Am I need to create one more filter? Or it function can take multiple arguments?

Another solution here is create a couple filters with different ignoring folders, and use OR argument in IF statement.

@dorny
Copy link
Owner

dorny commented Dec 15, 2020

If you want to ignore multiple folders inside the BigFolder you can use this:
BigFolder/!((InsideFolder|IgnoreThisToo)/**)/**
This will match everything inside BigFolder except files under InsideFolder and IgnoreThisToo folders.

If there would be too many folders to ignore it could be easier to switch to "whitelist" and explicitly lists folders you are interested in.

If you are not sure how the matching will behave I would suggest you to clone this repo and look into __tests__/filter.test.ts. It's quite easy to modify and run tests to see what would happen in some specific case. That's actually exactly what I did now.

@dorny dorny added the question Further information is requested label Dec 15, 2020
@avolusb
Copy link
Author

avolusb commented Dec 16, 2020

Yes, this solve all my problems, thank you very much for your help, happy new year!

@avolusb avolusb closed this as completed Dec 16, 2020
@jawahar-integrate
Copy link

Hi ,

I need help in ignoring the file , which is not actual ignore . I have two different work flows like metioned below structure ,

work_flow_A
src (with in work_flow_A. "dir")
file-1
flie-2
file -3
package.json (with in src dir)
src (top level dir)
file-1
file-2
package.json (top level dir)

jobs:
changes_detection:
runs-on:

steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
  id: filter
  with:
    base: ${{ github.ref }}
    filters: |
      run_work_flow_A:
       - 'work_flow_A/**'
       - '!src/**'
       - '!package.json'
      run_work_flow_b:
       - '!work_flow_A/**'

the work flow A should true when there is change in workflowA dir and it shoudl ignore if there is change in top level sc dir and in top level package.json file .

The workflow B should true when there is change in entire foler structure except the work_flow_A.

could you please help me in setting up these filters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants