trilom / file-changes-action

This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.
MIT License
167 stars 48 forks source link

Add ability to provide filter on changed files #94

Open DavidBrunow opened 4 years ago

DavidBrunow commented 4 years ago

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 commented 4 years ago

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

DavidBrunow commented 4 years ago

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 commented 4 years ago

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.