CodelyTV / pr-size-labeler

🏷 Visualize and optionally limit the size of your Pull Requests
https://github.com/marketplace/actions/pull-request-size-labeler
MIT License
336 stars 58 forks source link

Ignore files and folders by pattern? #38

Closed billxinli closed 1 year ago

billxinli commented 2 years ago

Is it possible to ignore files and folders by patterns?

For example, ignoring snapshots directories, ignoring JSON fixtures directories, ignoring some test folders.

Sometimes a change may be a few lines of code, however, the test itself could generate more than the limits defined.

morey-tech commented 2 years ago

Looking at the scripts, it compares the file_to_ignore string with the basename of the file which means, presently, this is not possible.

https://github.com/CodelyTV/pr-size-labeler/blob/54ef36785e9f4cb5ecf1949cfc9b00dbb621d761/src/github.sh#L24

billxinli commented 2 years ago

Oh interesting. Thank for you looking into this. I think this should be easily added. I might take a stab at this.

morey-tech commented 2 years ago

I was looking into what it might take to convert that to a globing match. Seems like compgen is an efficient solution for that.

We would need to implement a backwards-compatible solution, something where we default to matching a filename at the end of the path (so any parent directory) and also support more complex patterns. Maybe introduce a new input patterns_to_ignore?

mediamartin commented 2 years ago

@morey-tech wanted to also use a pattern to ignore so came into this topic. A separate input like patterns_to_ignore would be great!

alecmerdler commented 2 years ago

Would love to see this feature implemented. For our project that relies heavily on OpenAPI code generation, every pull request is being flagged.

wu-cl commented 1 year ago

50 Here is a solution for this feature, are there someone could review this patch?

wu-cl commented 1 year ago

@rgomezcasas