Potential fix for the negation causing any file that's not the negated file to match #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found this solution via this discussion: actions/labeler#101
It seems as though when
any
is used it means that any file that matches ALL of the given glob patterns will be labeled. So the workaround seems to be to use an individualany
list for the negated ones.In order to determine which files might match the negated ones, I used find and then checked the output against the list of labels, like so:
This tells me that when using the
!**/*UI.scala
glob, we only need to be concerned (at the moment) with any matches that would match the other existing globs for the label, in this caseCORE
. So here, we're only worried about/core/**/*
as that's the only glob from theCORE
label which potentially has any*UI.scala
files in it.Admittedly having to write the config this way is a bit cumbersome. We can either be thorough and use a separate
any
block with a list for each glob plus all of the negations, which would future proof us a bit more, or we can be conservative to keep the config simpler at the risk of possibly introducing invalid matches later if a*UI.scala
file gets placed under some other directory that is matched in the label which currently does not have subfiles with*UI.scala
, which we're trying to avoid.I would vote to keep the config more legible and then open an issue with the maintainers of this github action to see if something can be done.
What changes were proposed in this pull request?
Why are the changes needed?
Does this PR introduce any user-facing change?
How was this patch tested?