mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-20 02:35:58 +08:00
15
src/base.js
15
src/base.js
@@ -146,13 +146,28 @@ async function doMarkDuplicate(owner, repo, labels) {
|
||||
const duplicateLabels = core.getInput('duplicate-labels');
|
||||
const removeLables = core.getInput('remove-labels');
|
||||
const closeIssue = core.getInput('close-issue');
|
||||
const allowPermissions = core.getInput('allow-permissions');
|
||||
|
||||
const commentId = context.payload.comment.id;
|
||||
const commentBody = context.payload.comment.body;
|
||||
const commentUser = context.payload.comment.user.login;
|
||||
const issueNumber = context.payload.issue.number;
|
||||
|
||||
const ifCommandInput = !!duplicateCommand;
|
||||
|
||||
if (allowPermissions) {
|
||||
const res = await octokit.repos.getCollaboratorPermissionLevel({
|
||||
owner,
|
||||
repo,
|
||||
username: commentUser,
|
||||
});
|
||||
const { permission } = res.data;
|
||||
if (!allowPermissions.includes(permission)) {
|
||||
core.info(`The user ${commentUser} is not allow!`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!commentBody.includes('?') &&
|
||||
((ifCommandInput &&
|
||||
|
Reference in New Issue
Block a user