8000 Booleans for any / all changes detected · Issue #266 · dorny/paths-filter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Booleans for any / all changes detected #266
Open
@sc250024

Description

@sc250024

Greetings!

I am wondering if it's possible to add output booleans called any and all to match the conditions where any or all of the filters are evaluated as true?

Using the example from the README.md file:

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dorny/paths-filter@v3
      id: filter
      with:
        filters: |
          backend:
            - 'backend/**'
          frontend:
            - 'frontend/**'

    # run only if 'backend' files were changed
    - name: backend tests
      if: steps.filter.outputs.backend == 'true'
      run: ...

    # run only if 'frontend' files were changed
    - name: frontend tests
      if: steps.filter.outputs.frontend == 'true'
      run: ...

    # run if 'backend' or 'frontend' files were changed
    - name: e2e tests
      if: steps.filter.outputs.backend == 'true' || steps.filter.outputs.frontend == 'true'
      run: ...

In that example, the e2e tests step needs to know about the keys backend and frontend. This works for a normal workflow, but I am putting the dorny/paths-filter@v3 inside of a reusable workflow, and I want to give the user the option to pass in additional filters.

In that scenario, my e2e tests (which is inside of a reusable workflow) wouldn't know which keys are important. I would instead want something like this:

    # run if 'backend' or 'frontend' files were changed
    - name: e2e tests
      if: steps.filter.outputs.any == 'true'
      run: ...

Using steps.filter.outputs.any == 'true' would replace the OR check of steps.filter.outputs.backend == 'true' || steps.filter.outputs.frontend == 'true'.

Is this possible?

Going further, the matrix of the above would evaluate as follows:

Backend Frontend Any All
true true true true
true false true false
false true true false
false false false false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0