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

Allow changed files as input #256

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

pecigonzalo
Copy link

We have a use-case in which we want to enrich the changed files/paths with some script and then run it through the filter. Since this action already does 90% of the job, I think it would be a great addition to support an additional optional input here that passes the list, instead of creating a new action.

Let me know what you think, and what would be required in order to merge this.

Thanks!

Example use-case:

      - uses: dorny/paths-filter@v3
        id: filter
        with:
          list-files: shell
          filters: |
            go:
              - go.mod
              - go.sum
              - "**.go"

      - id: go-find-cmd
        if: steps.filter.outputs.go == 'true'
        run: |
          echo "cmds<<EOF" >> "$GITHUB_OUTPUT"
          echo "$(./hack/go-find-cmd ${{ steps.filter.outputs.go_files }})" >> "$GITHUB_OUTPUT"
          echo "EOF" >> "$GITHUB_OUTPUT"

      - uses: pecigonzalo/paths-filter@feature/input-files
        if: steps.filter.outputs.go == 'true'
        id: go-filter
        with:
          files: ${{ steps.go-find-cmd.outputs.cmds }}
          filters: |
            foo:
              - cmd/foo/**
            bar:
              - cmd/bar/**

./hack/go-find-cmd provides yaml output like:

- foo
- bar

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 this pull request may close these issues.

1 participant