github-label-sync
github-label-sync copied to clipboard
Provide a config schema for categorization of labels
I've been thinking about my label use cases, and I find that on most of my repositories, I've gotten into the habit of a label schema if you will. Things like type/xxxx
or area/yyyy
, status/zzz
, and so on.
I'm trying to think of a forwards compatible mode where you could adorn a label with a property, and if that property matches an optional input file schema, would get color and prefix from the input schema.
Here's an off-the-cuff example:
{
"config": {
"delimiter": "/",
"allow-added-labels": false,
"categories": [
{
"name": "type",
"delimiter": "@",
"color": "aaccff",
"aliases": [ "type:", "type=", "type/" ]
},
{
"name": "status",
"color": "3377aa",
"aliases": [ "status:" ]
}
]
}
}
Then, in my label file, we'd have a new optional property called category:
[
{
"name": "bug",
"category": "type",
"aliases": [
"bug"
]
},
{
"name": "breaking",
"category": "type",
"aliases": [
"breaking",
"breaking-change"
]
},
{
"name": "wontfix",
"category": "status",
"aliases": [
"wont-fix",
"won't fix",
"wont fix"
]
}
]
The merged labels would look like this:
[
{
"name": "type@bug",
"color": "aaccff",
"aliases": [
"bug",
"type:bug",
"type/bug",
"type=bug"
]
},
{
"name": "type@breaking",
"color": "aaccff",
"aliases": [
"breaking",
"breaking-change",
"type:breaking",
"type:breaking-change",
"type/breaking",
"type/breaking-change",
"type=breaking",
"type=breaking-change",
]
},
{
"name": "status/wontfix",
"color": "3377aa",
"aliases": [
"wont-fix",
"won't fix",
"wont fix"
"status:wont-fix",
"status:won't fix",
"status:wont fix"
]
}
]
I would perhaps call this like so:
$ github-label-sync --config myconfig.json --labels source1.json --labels source2.json
Loading myconfig.json
allow-added-labels: false
delimiter: "/"
Thoughts?