feat: add lock-reason (#49)

* feat: add lock-reason

* add dist
This commit is contained in:
xrkffgg
2021-01-26 22:17:55 +08:00
committed by GitHub
parent 1425c335af
commit 616c112b12
9 changed files with 34 additions and 4 deletions

View File

@@ -132,11 +132,17 @@ async function doDeleteComment(owner, repo, commentId) {
}
async function doLockIssue(owner, repo, issueNumber) {
await octokit.issues.lock({
const lockReason = core.getInput('lock-reason');
let params = {
owner,
repo,
issue_number: issueNumber,
});
};
const reasons = ['off-topic', 'too heated', 'resolved', 'spam'];
if (lockReason && reasons.includes(lockReason)) {
params.lock_reason = lockReason;
}
await octokit.issues.lock(params);
core.info(`Actions: [lock-issue][${issueNumber}] success!`);
}