octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.
MIT License
7.03k stars 1.03k forks source link

issues.updateLabel() - does not update label name #249

Closed carlos-r-mendoza closed 8 years ago

carlos-r-mendoza commented 9 years ago

There seems to be no way to update a label name using issues.updateLabel(). The only name value possible to pass in is the current name of the label and not the desired new name. Anyone have a workaround this?

Code sample below.

/_EDIT REPO LABEL_/ /More info: http://mikedeboer.github.io/node-github/#issues.prototype.updateLabel/ router.post('/:repoOwner/:repoName/edit-repo-label/:labelName', function (req, res) {

var userToken = req.user.github.token;
var labelName = req.body.name;
var labelColor = req.body.color;

var github = new GitHubApi({
// required
version: "3.0.0"
//optional
// debug: true,
// protocol: "https",
// host: "api.github.com", // should be api.github.com for GitHub
// pathPrefix: "/api/v3", // for some GHEs; none for GitHub
// timeout: 5000,
// headers: {
//     "user-agent": "My-Cool-GitHub-App" // GitHub is happy with a unique user agent
// }
});

github.authenticate({
    type: "oauth",
    token: userToken
});

github.issues.updateLabel({
    user: req.params.repoOwner,
    repo: req.params.repoName,
    name: labelName,
    color: labelColor
}, function(err, updatedRepoLabel) {
    console.log(updatedRepoLabel)
    res.json(updatedRepoLabel);
});

});

kaizensoze commented 8 years ago

Seems to just be a limitation of the github api. Only workaround really is to delete and then add.