action-label-syncer icon indicating copy to clipboard operation
action-label-syncer copied to clipboard

feat: Label renaming and import statements

Open joeyparrish opened this issue 3 years ago • 6 comments

This adds two main features: label renaming and import statements.

Label renaming is an extension of the work done by @larsks in PR #60. To the renaming support in #60 (alias field), I added a list-of-strings field called aliases, to better support single configs that can be used across repositories. For example, each repo could have a different existing bug label that you may to rename to unify them:

- name: "Type: bug"
  aliases:
    - bug
    - defect
  description: Something isn't working
  color: d73a4a

The import statement further enhances our ability to share configs across repos. Common fields needed by all repos (such as Type: bug) could be placed in a common config file. Then, each repo has its own config file with its unique labels, and the common ones get imported. For example:

# common.yaml
- name: "Type: bug"
  aliases:
    - bug
    - defect
  description: Something isn't working
  color: d73a4a
# repo1.yaml
- import: common.yaml

- name: "Platform: iOS"
  description: Issues specific to iOS
  color: d73a4a

Finally, this makes some additional changes I found useful in testing and development:

  • Error early instead of trying to change a label with a question mark in the name.
  • Error early if description is too long. GitHub will reject these labels, so we should identify them early and provide a clear message.
  • Serialize label changes. Doing them in parallel does not make the process much faster, but it does make the logs more difficult to read.
  • Fix silent errors from main.
  • Add dry-run flag. Useful for testing a large migration before making it final.

Closes #59

joeyparrish avatar Feb 15 '22 01:02 joeyparrish

@larsks, @micnncim, please let me know if you have any feedback. Thanks!

joeyparrish avatar Feb 15 '22 20:02 joeyparrish

@micnncim, I can continue using my fork indefinitely if I must, but I always prefer to contribute upstream. Please let me know if you have feedback. Thanks!

joeyparrish avatar Feb 22 '22 17:02 joeyparrish

Sorry for being too late. Some feedback I can give you as of now:

  • Please separate the PR per feature/fix
  • Please create an issue for the import feature and discuss it there

This would make your change easier to be merged into this project.

micnncim avatar Feb 28 '22 06:02 micnncim

Issue #59 already existed for the renaming feature. I've updated it with the details of my extension to allow multiple aliases.

I've filed #69 for the import feature.

joeyparrish avatar Feb 28 '22 22:02 joeyparrish

This is a really nice feature. Any chance to merge this?

maxisam avatar Jan 19 '24 21:01 maxisam