monorepo-diff-buildkite-plugin icon indicating copy to clipboard operation
monorepo-diff-buildkite-plugin copied to clipboard

Support all glob path patterns

Open cycraig opened this issue 1 year ago • 2 comments

Description

Only * and ** work when used in a path trigger. It would be nice to use curly braces too.

Curly brace patterns are supported by doublestar (the library used for */** in this repo), and actually work currently, but only if the path includes * too.

Example

steps:
  - label: "Triggering pipelines with glob paths"
    plugins:
      - monebag/monorepo-diff#v2.5.9:
          diff: "git diff --name-only HEAD~1"
          watch:
            - path:
                - "rust/**/*.{rs,toml,lock}" # works
                - "rust/{foo,bar}/*.{rs,sql}" # works
                - "scripts/{git-diff,install-rust}.sh" # fails, no trigger
              config:
                command: "cargo check"

Suggestion

I believe this is the relevant code? Maybe it's sufficient to check for pairs of brackets too?

This is probably a breaking change, since existing path triggers containing brackets {}/[] might behave differently (if those paths don't contain *).

https://github.com/monebag/monorepo-diff-buildkite-plugin/blob/3f65d099261bf9680da137cc4cabc363bcabcb8d/pipeline.go#L120-L125

cycraig avatar Sep 26 '23 15:09 cycraig