Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a config schema for categorization of labels #51

Open
kenperkins opened this issue May 6, 2020 · 0 comments
Open

Provide a config schema for categorization of labels #51

kenperkins opened this issue May 6, 2020 · 0 comments

Comments

@kenperkins
Copy link
Contributor

kenperkins commented May 6, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant