Giter Site home page Giter Site logo

Comments (12)

srvaroa avatar srvaroa commented on August 28, 2024 2

Hi, sorry I totally missed this issue. I will take a closer look into this in the coming days. Thanks for reporting.

from labeler.

akutz avatar akutz commented on August 28, 2024 1

That would be great, thank you! Please see https://github.com/vmware-tanzu/vm-operator/blob/3ebc8097d391c2356073d7c327b1b0f72d44f5b0/.github/workflows/pr-labeler.yml#L12-L33 for more information.

from labeler.

jhlegarreta avatar jhlegarreta commented on August 28, 2024

Tested in a test repository of my own, and it looks like the mentioned regex pattern is not appropriately dealt with:

 type:BookStyle:
  files:
    - "^Latex/[^/]*"
2021/11/21 00:47:15 Unable to unmarshall legacy config: yaml: unmarshal errors:
  line 3: cannot unmarshal !!seq into labeler.LabelMatcher
  line 5: cannot unmarshal !!seq into labeler.LabelMatcher
  line 7: cannot unmarshal !!seq into labeler.LabelMatcher
  line 9: cannot unmarshal !!seq into labeler.LabelMatcher
  line 11: cannot unmarshal !!seq into labeler.LabelMatcher
  line 15: cannot unmarshal !!seq into labeler.LabelMatcher

Looks like the regex cannot be read properly in here (?):
https://github.com/srvaroa/labeler/blob/master/cmd/action.go#L102

Does addressing this look doable @srvaroa ? Thanks for the effort.

from labeler.

akutz avatar akutz commented on August 28, 2024

Mentioned in vmware-tanzu/vm-operator#50 (review) (this was not added automatically for some reason)

from labeler.

philippwaller avatar philippwaller commented on August 28, 2024

@jhlegarreta, @akutz: I believe this thread might be helpful to you:

As this GitHub Action is written in Go (Golang), handling regular expressions (Regex) requires a bit of extra care. Specifically, you'll need to escape special characters using double backslashes. This is because the backslash in Go strings is an escape character and therefore must be escaped itself.
Here's an example that should work:

- label: "File"
  files:
    - ".*\\/subfolder\\/.*\\.md"

To clarify this, I've submitted PR (#129) that updates the documentation accordingly.

Originally posted by @philippwaller in #50 (comment)

@srvaroa: Presumably, this is about the same issue.

from labeler.

srvaroa avatar srvaroa commented on August 28, 2024

Yeah, I will add a couple of test cases to prove the examples provided above.

from labeler.

jhlegarreta avatar jhlegarreta commented on August 28, 2024

@philippwaller thanks for the heads-up; @srvaroa thanks for the documentation; I will try to test it as time permits.

from labeler.

akutz avatar akutz commented on August 28, 2024

It is unclear if this actually adds support for excluding file patterns. The negate option does not really work either. We need a way to express:

Apply this label if CONDITION except for GENERATED FILES

Essentially we want to apply labels based on the size of the change, but the size should not be calculated based on changes related to generated content.

from labeler.

srvaroa avatar srvaroa commented on August 28, 2024

@akutz the size condition supports an exclude-files option for this purpose. Right now this only supports explicit exclusions but I could turn it into a regex if that's what you need.

from labeler.

srvaroa avatar srvaroa commented on August 28, 2024

@jhlegarreta @akutz this should deal with the exclusions in the Size condition. There is an example that should be reasonably understandable in the tests. Let me knot if this looks good for you and I'll get this released asap.

from labeler.

srvaroa avatar srvaroa commented on August 28, 2024

@jhlegarreta I have added a couple of tests to verify the conditions you quoted above. It looks like the expressions work correctly after escaping the characters.

Let me know if that solves your use case.

Tests here -> https://github.com/srvaroa/labeler/pull/132/files#diff-133334d6ef7baf3e8c0bc80d52a8a7c185e1fca8345190d244e4c7c66ee89925R537

from labeler.

srvaroa avatar srvaroa commented on August 28, 2024

I will close this for now, but @jhlegarreta do let me know if your issue is still not solved.

from labeler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.