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

Add ability to provide filter on changed files #94

Open
DavidBrunow opened this issue Apr 11, 2020 · 3 comments
Open

Add ability to provide filter on changed files #94

DavidBrunow opened this issue Apr 11, 2020 · 3 comments
Labels
enhancement New feature or request good first issue Low hanging fruit.

Comments

@DavidBrunow
Copy link

Is your feature request related to a problem? Please describe.
I would like to be able to lint all of my code files and want to be able to pass in that list of files to the linter. Currently when using this action I get files that are not code files that have been changed.

Describe the solution you'd like
I'd like to be able to provide a string that can be used to filter the list of changed files that is returned.

Describe alternatives you've considered
Haven't come up with one that will work but I am new to GitHub Actions so I might be missing something obvious

Additional context
Don't have any additional context but if you think this would be a useful feature then I can work on a pull request to implement this.

@trilom
Copy link
Owner

trilom commented Apr 11, 2020

Hey David, thanks for your contribution.

What I think you might be able to use is Paths this is usually how I use this action.

For example, put templates in one dir, then have an action that watches that dir with the config above for changes to the files.

This enhancement wouldn't be super difficult but not something I can do at this time since it has some partial coverage (my proposed solution will not work for ALL github events so I can see why you might need what you are suggesting).

Thanks

@trilom trilom added enhancement New feature or request good first issue Low hanging fruit. labels Apr 11, 2020
@DavidBrunow
Copy link
Author

DavidBrunow commented Apr 11, 2020

The problem with Paths (as far as I understand, again I am new to GitHub Actions) is that a pull request could have a file in the path that triggers the action in addition to another file that I do not want to be processed. For example, if I change a .swift file in the proper path and a .yml file that is not in that path in the same pull request then from what I understand both of those files will show as changed files and therefore both will be passed into my linter.

I'll try to put together a pull request tomorrow.

@trilom
Copy link
Owner

trilom commented Apr 11, 2020

The problem with Paths (as far as I understand, again I am new to GitHub Actions) is that a pull request could have a file in the path that triggers the action in addition to another file that I do not want to be processed. For example, if I change a .swift file in the proper path and a .yml file that is not in that path in the same pull request then from what I understand both of those files will show as changed files and therefore both will be passed into my linter.

I'll try to put together a pull request tomorrow.

David I understand.

I think one thing I like about the action is it's simple and it does one thing (just give you a list of files). The magic should happen downstream with those files. In some cases I can see the need to filter at this point instead of adding logic to filter later.

My goal with this action + another is to create a process that will (in this action) receive the list of changed files and in an action similar to this run the commands generated from the output files.

In my case I used the original script of that to do the following:

1.) Use this (file-changes-action) to get list of files.
2.) Pass to .js script to figure out with AWS Cloudformation templates to deploy/modifiy then generate commands to run.
3.) Run said commands.

It seems you have a similar workflow and that other action referenced should take care of similar things. Take the time to read through the readme on that branch. and look at more complex examples and please provide input.

The scope of that project has changed a little bit and will have a handful of changes but for the most part should be used after file-changes-action to perform actions on the files changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Low hanging fruit.
Projects
None yet
Development

No branches or pull requests

2 participants