github-label-sync icon indicating copy to clipboard operation
github-label-sync copied to clipboard

Add format validations

Open srealmoreno opened this issue 3 years ago β€’ 0 comments

Resolve #171

  • Add validation 'Name: Must contain more than native emojis'
  • Add validation 'Description: '4-byte characters are not allowed'

The regular expression to check the emojis is very long, but there is a proposal. Matching emoji sequences

labels.yml

- name: πŸ˜€ πŸ˜ƒ πŸ˜„ 😁
  color: "536266"
  description: This is a name only contains emojis

- name: bug 🐞
  color: d73a4a
  description: 
    This is a description that contains emojis 4-byte unicode 🐞

Current behaviour

Syncing labels for "srealmoreno/test-label-sync"
Validating provided labels
Fetching labels from GitHub
 > Missing: the "πŸ˜€ πŸ˜ƒ πŸ˜„ 😁" label is missing from the repo. It will be created.
 > Missing: the "bug 🐞" label is missing from the repo. It will be created.
Applying label changes, please wait…
GitHub Error:
POST /repos/srealmoreno/test-label-sync/labels
422: Validation Failed

New behaviour

Syncing labels for "srealmoreno/test-label-sync"
Validating provided labels
Invalid label:
  {"name":"πŸ˜€ πŸ˜ƒ πŸ˜„ 😁","color":"536266","description":"This is a name only contains emojis"}
  - name must match format "must contain more than native emoji"

Invalid label:
  {"name":"bug 🐞","color":"d73a4a","description":"This is a description that contains emojis 4-byte unicode 🐞"}
  - description must match format "doesn't accept 4-byte Unicode"

srealmoreno avatar Jun 13 '22 21:06 srealmoreno