This commit is contained in:
xrkffgg
2021-02-02 20:12:42 +08:00
parent f6788d2b8e
commit 1cc6f0b7ca
6 changed files with 124 additions and 8 deletions

30
dist/index.js vendored
View File

@@ -7985,6 +7985,30 @@ async function doCreateIssueContent(owner, repo, issueNumber, contents) {
}
}
async function doCreateLabel(owner, repo) {
const name = core.getInput('label-name');
const color = core.getInput('label-color') || 'ededed';
const description = core.getInput('label-desc') || '';
if (!name) {
core.setFailed(`This actions should input 'label-name'!`);
return false;
}
try {
await octokit.issues.createLabel({
owner,
repo,
name,
color,
description,
});
core.info(`Actions: [create-label][${name}] success!`);
} catch (err) {
console.log(err.message)
}
}
async function doDeleteComment(owner, repo, commentId) {
await octokit.issues.deleteComment({
owner,
@@ -8313,6 +8337,7 @@ module.exports = {
doCreateCommentContent,
doCreateIssue,
doCreateIssueContent,
doCreateLabel,
doDeleteComment,
doMarkDuplicate,
doLockIssue,
@@ -8342,6 +8367,7 @@ const {
doCloseIssue,
doCreateComment,
doCreateIssue,
doCreateLabel,
doDeleteComment,
doMarkDuplicate,
doLockIssue,
@@ -8372,6 +8398,7 @@ const ALLACTIONS = [
'close-issue',
'create-comment',
'create-issue',
'create-label',
'delete-comment',
'lock-issue',
'mark-duplicate',
@@ -8452,6 +8479,9 @@ async function main() {
case 'create-issue':
await doCreateIssue(owner, repo, title, body, labels, assignees);
break;
case 'create-label':
await doCreateLabel(owner, repo);
break;
case 'delete-comment':
await doDeleteComment(owner, repo, commentId);
break;