2

I have a GitHub workflow that is triggered when files according to the pattern **/abc** are modified / created. As far as I understand it, this means that whenever a:

  1. File that is in some subfolder of a folder that starts with abc or
  2. Any file that starts with abc

is modified, the GH action should be triggered. However, the workflow is even triggered when I e.g. create a file repository/aaa/test_abc

However, to my understanding, the file repository/aaa/test_abc does not correspond to the pattern **/abc**

Do I

  1. Misunderstand GH actions syntax or is it
  2. A Bug in GH actions?
8
  • Did you use quote: '**/abc**' like explained on the filter pattern cheat sheet? Commented Nov 24, 2021 at 19:48
  • Yes I used quotation marks. Commented Nov 24, 2021 at 19:55
  • As / is a special character in regex, the syntax might be different. If it was a regex pattern you would have to add a \ before the / to do something like this: \/abc. However, I'm not sure it will work here as the syntax used with ** on GHA seems a bit different. I will make some tests. Commented Nov 24, 2021 at 20:03
  • @GuiFalourd / is not any special regex metacharacter. It is often escaped in regex literal notation only because it is used as a regex delimiter char. If regex literal notation is not used, no need to escape /. Commented Nov 24, 2021 at 20:07
  • 1
    **/abc** is not a regex pattern. No regex should start with a quantifier. This is a glob pattern. Commented Nov 24, 2021 at 20:08

1 Answer 1

5

You need to escape the / with a \ for the pattern to work.

Using '**\/abc**' will resolve the problem.

Most of the time, the filter pattern cheat sheet for the Github Documentation helps to configure the paths, but in that specific case it wasn't detailed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.