labeler icon indicating copy to clipboard operation
labeler copied to clipboard

Some regex not working in filter via property

Open mytrancoinhako opened this issue 2 years ago • 1 comments

i need to filter some changed files in specific directory but the applied regex not working even I tested on https://regex101.com/

  • label: "payment" files:
    • "feature/wallet/.*"

- "(.*?)\/(addressbook|travelrules|walletsigning)\/.*"

mytrancoinhako avatar Oct 05 '22 10:10 mytrancoinhako

I am having the same issue and it only happens on the files property

Mar0xy avatar Oct 12 '22 05:10 Mar0xy

@mytrancoinhako, @Mar0xy: 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.

philippwaller avatar Dec 19 '23 20:12 philippwaller

Thanks @philippwaller , a while back I added this note to the docs on this topic, it has a link to https://regex101.com with the golang flavour which is needed to match the behaviour in the action. The tests and docs update made by @philippwaller should make this clearer.

I will close this issue for now but let me know if the issue is solved for you.

srvaroa avatar Dec 19 '23 20:12 srvaroa

Related to/duplicate of #105

jrfnl avatar Dec 19 '23 21:12 jrfnl