feat: add allow-permissions (#46)

* feat: add

* up

* up

* add doc
This commit is contained in:
xrkffgg
2021-01-26 17:55:42 +08:00
committed by GitHub
parent 4c5e1fa83c
commit f777971d6d
7 changed files with 259 additions and 263 deletions

View File

@@ -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 &&