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

Use recursive rules #12

Closed
Shatur opened this issue Jun 19, 2020 · 4 comments · Fixed by #13
Closed

Use recursive rules #12

Shatur opened this issue Jun 19, 2020 · 4 comments · Fixed by #13

Comments

@Shatur
Copy link

Shatur commented Jun 19, 2020

Thank you a lot for this action!
Could you add the ability to use rules recursively?
For example:

- name: Detect changes
  uses: dorny/[email protected]
  id: changes
  with:
    filters: |
      all:
        - '.github/workflows/main.yml'
        - 'CMakeLists.txt'
        - 'CMake/**'
      utils:
        - ${{ steps.changes.filters.all }}
        - 'Utils/**'

Such rule would allow to avoid always check for all rule in every step. This is just a simple example. But such feature can help to avoid duplicated paths in dependent filters (very usefull for project with complex dependencies).

@dorny
Copy link
Owner

dorny commented Jun 19, 2020

I'm glad you find it useful :)

Your proposal should be possible to implement without heavy effort using YAML anchors.
Syntax would be slightly different but it will do the job. I will look into it during next days.

Meanwhile you could consider moving this logic into workflows if statements:

if: steps.changes.outputs.all == 'true' || steps.changes.outputs.utils == 'true'

@Shatur
Copy link
Author

Shatur commented Jun 19, 2020

Thanks!

Meanwhile you could consider moving this logic into workflows if statements:

Yes, this is how I using it right now. Also I have a lot of related components. The suggested feature will reduce a lot of copy-paste :)

@Shatur
Copy link
Author

Shatur commented Jun 19, 2020

Thank you a lot!

@dorny
Copy link
Owner

dorny commented Jun 19, 2020

Given your example, following setup should work now:

all: &all
  - '.github/workflows/main.yml'
  - 'CMakeLists.txt'
  - 'CMake/**'
utils:
  - *all
  - 'Utils/**'

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

Successfully merging a pull request may close this issue.

2 participants