Comments (6)
This seems like a helpful idea! I think we probably should be able to do something like this, I want to be careful here though - I don't want to break existing configurations, so I don't want to change the syntax of the yml
file.
I think a better approach might be to support !
as a negate pattern. So you're example would look the following instead:
label1:
- "!example1/foo/*"
- "!example1/bar/*"
- "example1/**/*"
Probably, we'd want to evaluate sequentially until we find a pattern that matches. So that way we could even do something like:
label2:
- "!example2/foo/bar"
- "example2/foo/**/*"
- "!example2/**/*"
- "**/*"
The above example would not match example2/foo/bar/abc.txt
, would match example2/foo/baz/abc.txt
, would not match example2/notFoo/baz/abc.txt
, and would match notExample2/foo/baz/abc.txt
since the patterns are evaluated in order - I think this would be about as powerful as we can get.
Thoughts?
from labeler.
I don't want to break existing configurations, so I don't want to change the syntax of the yml file.
Actually, that's exactly why I proposed the syntax above. Maps aren't currently handled and it should be possible to support existing configuration files without breaking them.
I had thought about negation, but my fear is that it would cause confusion with the semantics of the list as it stands today. Today the label is applied if any path matches. Should negation mean that a non-match should receive the label? Or that we should stop searching? It would also mean that the order of the rules matter. That's why I figured it would be better to be explicit with a map.
That being said, if you're comfortable with order being significant, then I'd certainly prefer your proposed syntax. It's certainly simpler than what I proposed!
from labeler.
Actually, that's exactly why I proposed the syntax above. Maps aren't currently handled and it should be possible to support existing configuration files without breaking them.
Ah I see, that makes sense - at the same time, I don't think I want us to support 2 different syntaxes if possible though - that leads me to prefer an additive pattern if possible
if you're comfortable with order being significant
I actually think this is a pretty common pattern that I've seen elsewhere. I think as long as we doc it, it should be fine. I think it makes intuitive sense as well (at least to me 😄).
from labeler.
@damccorm took a stab at this. Testing against a local repo has proven to provide the flexibility we need.
from labeler.
i'm trying to use this to match only if specific file is changed, but not if that specific file and another one are modified but dosn't seem possible with this change.
the idea would be to add the label only if all the files match the pattern, is that possible?
from labeler.
i'm trying to use this to match only if specific file is changed, but not if that specific file and another one are modified but dosn't seem possible with this change.
the idea would be to add the label only if all the files match the pattern, is that possible?
@fluzzi discussion is taking place in #22. However, I think I can support your use case if the maintainers are willing to accept my map
configuration proposal.
Your use case could be represented as:
label1:
- match: "example1/foo"
exclude: ["example1/bar"]
from labeler.
Related Issues (20)
- Netatmo zusatz Innenmodul HOT 1
- sync-labels is (but shouldn't be) mandatory for jobs HOT 4
- Update default runtime to node20 HOT 2
- `Error: HttpError: Not Found` on v5 when using the `configuration-path` input HOT 4
- Dynamic label creation from path HOT 2
- found unexpected type for label 'xxxxxxxx' (should be array of config options) HOT 4
- Error: found unexpected type for label 'xxx' (should be array of config options) HOT 26
- Sync not working on labels with exceptions HOT 3
- Simpler structure for configuration. HOT 8
- Labeler does not work when i change tha base branch HOT 2
- Getting `sync-labels` type error after update to 5 version. HOT 4
- Create dynamic labels from branch name HOT 1
- any-glob-all-files does not working intuitevely HOT 4
- Sync-labels should not remove an unspecified label HOT 2
- Error when configuration is invalid HOT 1
- Branch name checks ignored as top level key HOT 2
- example fails yaml validation HOT 7
- Char HOT 1
- Node 16 gets warning HOT 2
- Description seems dangerous HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from labeler.