mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-21 11:15:50 +08:00
refactor: rename allow-permissions (#48)
* refactor: rename allow-permissions * up
This commit is contained in:
13
src/base.js
13
src/base.js
@@ -8,7 +8,12 @@ const ALLREACTIONS = ['+1', '-1', 'laugh', 'confused', 'heart', 'hooray', 'rocke
|
||||
|
||||
const { doQueryIssues } = require('./public.js');
|
||||
|
||||
const { dealStringToArr, dealRandomAssignees, testDuplicate } = require('./util.js');
|
||||
const {
|
||||
dealStringToArr,
|
||||
dealRandomAssignees,
|
||||
testDuplicate,
|
||||
checkPermission,
|
||||
} = require('./util.js');
|
||||
|
||||
// **************************************************************************
|
||||
const token = core.getInput('token');
|
||||
@@ -146,7 +151,7 @@ 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 requirePermission = core.getInput('require-permission');
|
||||
|
||||
const commentId = context.payload.comment.id;
|
||||
const commentBody = context.payload.comment.body;
|
||||
@@ -155,14 +160,14 @@ async function doMarkDuplicate(owner, repo, labels) {
|
||||
|
||||
const ifCommandInput = !!duplicateCommand;
|
||||
|
||||
if (allowPermissions) {
|
||||
if (requirePermission) {
|
||||
const res = await octokit.repos.getCollaboratorPermissionLevel({
|
||||
owner,
|
||||
repo,
|
||||
username: commentUser,
|
||||
});
|
||||
const { permission } = res.data;
|
||||
if (!allowPermissions.includes(permission)) {
|
||||
if (!checkPermission(requirePermission, permission)) {
|
||||
core.info(`The user ${commentUser} is not allow!`);
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user