首页 > 解决方案 > 使用 GitHub 操作向问题添加自定义标签

问题描述

我想为使用 GitHub 操作创建的每个问题添加标签“需要更改”。

这是我尝试过的代码片段。

const octokit = new github.getOctokit(github_token);

octokit.issues.createLabel({ 
     owner: context.repo.owner,
     repo: context.repo.repo,
     name: 'changes needed',
     description: 'New changes or updates proposed',
     color: 'BFD4F2', // this is a green color
   });

我收到这个错误。

(node:1919) UnhandledPromiseRejectionWarning: HttpError: Invalid request.

No subschema in "anyOf" matched.
For 'anyOf/0', {"labels"=>"proposed"} is not an array.
For 'anyOf/1', {"labels"=>"proposed"} is not an array.
For 'properties/labels', "proposed" is not an array.
    at /home/runner/work/_actions/Karthik-Nayak98/Greeting-action/main/webpack:/greeting-action/node_modules/@octokit/request/dist-node/index.js:66:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

任何形式的帮助表示赞赏。谢谢!!

标签: githubgithub-actions

解决方案


推荐阅读