commercetools/github-labels

RequestError [HttpError]: Empty value for parameter 'color': undefined

Closed this issue · 1 comments

Steps to Reproduce

.github-labelsrc.json

[
  {
    "name": "label",
    "description": ""
  }
]
$ github-labels sync
RequestError [HttpError]: Empty value for parameter 'color': undefined

("@commercetools/github-labels": "1.0.2")

Current Behavior

The "color" config field marked optional are still required

Full output:
$ github-labels sync
RequestError [HttpError]: Empty value for parameter 'color': undefined
    at /Users/marina/Desktop/dev-projects/github/cogn-project-template/node_modules/@octokit/rest/plugins/validate/validate.js:66:15
    at Array.forEach (<anonymous>)
    at /Users/marina/Desktop/dev-projects/github/cogn-project-template/node_modules/@octokit/rest/plugins/validate/validate.js:38:12
    at Array.forEach (<anonymous>)
    at validate (/Users/marina/Desktop/dev-projects/github/cogn-project-template/node_modules/@octokit/rest/plugins/validate/validate.js:15:23)
    at processTicksAndRejections (internal/process/task_queues.js:89:5) {
  name: 'HttpError',
  status: 400,
  headers: undefined,
  request: {
    method: 'POST',
    baseUrl: 'https://api.github.com',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit.js/16.28.2 Node.js/12.4.0 (macOS Mojave; x64)'
    },
    mediaType: { format: '', previews: [Array] },
    request: { hook: [Function: bound bound register], validate: [Object] },
    url: '/repos/:owner/:repo/labels',
    owner: 'CognitiveLaunchpad',
    repo: 'cogn-project-template',
    name: 'label',
    color: undefined,
    description: ''
  }
}

  GITHUB LABEL MANAGER

    Usage: ./bin/glm [command] [option]

      Commands:
        init        Initializes the label manager. It creates a new label-config.json
                    file with the current label data of your repository.

        sync        Uploads all changes you've made in the label-config.json file
                    into the repository to update the label with the given changes.
  
error Command failed with exit code 1.

Possible Solution

Set defaut value for color

color: label.color,

(https://developer.github.com/v3/issues/labels/#create-a-label)

Possible Implementation

      color: label.color || 'ffffff',

@cognitivim Thank you for creating this issue! 🥇
We have decided to change the color value from optional to required to ensure that each label has a manually set color code. That's why a default color value is no longer necessary :)
PR: #17