mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-19 18:25:58 +08:00
@@ -400,10 +400,15 @@ jobs:
|
||||
| labels | Replace the labels of the issue | string | ✖ |
|
||||
| contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
|
||||
| close-issue | Whether to close the issue at the same time | string | ✖ |
|
||||
| allow-permissions | Permission to operate | string | ✖ |
|
||||
|
||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
|
||||
- `labels`: Highest priority
|
||||
- `close-issue`: Both `true` or `'true'` can take effect
|
||||
- `allow-permissions`: When you do not input, there is no limit. Anyone comment will trigger. Optional values are `admin`, `write`, `read`, `none`
|
||||
- If the team member sets the read permission, it is read
|
||||
- If the external Collaborator is set to read permission, it is read
|
||||
- Ordinary users have read permission
|
||||
|
||||
⏫ [Back to list](#List)
|
||||
|
||||
|
@@ -400,10 +400,15 @@ jobs:
|
||||
| labels | 替换该 issue 的 labels | string | ✖ |
|
||||
| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
|
||||
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
||||
| allow-permissions | 允许操作的权限 | string | ✖ |
|
||||
|
||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
||||
- `labels`:优先级最高
|
||||
- `close-issue`:`true` 或 `'true'` 均可生效
|
||||
- `allow-permissions`:当不输时,即无限制。任何人评论都会触发。可选值有 `admin`,`write`,`read`,`none`
|
||||
- 团队成员若设置 read 权限,则为 read
|
||||
- 外部 Collaborator 若设置 read 权限,则为 read
|
||||
- 普通用户为 read 权限
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
|
@@ -58,6 +58,8 @@ inputs:
|
||||
description: 'For mark-duplicate'
|
||||
duplicate-labels:
|
||||
description: 'For mark-duplicate add labels'
|
||||
allow-permissions:
|
||||
description: 'Only the allow can do. Possible admin, write, read, and none.'
|
||||
remove-labels:
|
||||
description: 'For remove labels'
|
||||
close-issue:
|
||||
|
485
dist/index.js
vendored
485
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -264,10 +264,15 @@ jobs:
|
||||
| labels | Replace the labels of the issue | string | ✖ |
|
||||
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ |
|
||||
| close-issue | Whether to close the issue at the same time | string | ✖ |
|
||||
| allow-permissions | Permission to operate | string | ✖ |
|
||||
|
||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
|
||||
- `labels`: Highest priority
|
||||
- `close-issue`: Both `true` or `'true'` can take effect
|
||||
- `allow-permissions`: When you do not input, there is no limit. Anyone comment will trigger. Optional values are `admin`, `write`, `read`, `none`
|
||||
- If the team member sets the read permission, it is read
|
||||
- If the external Collaborator is set to read permission, it is read
|
||||
- Ordinary users have read permission
|
||||
|
||||
<Alert>
|
||||
Note: Duplicate created with the concise command does not display the content of the red box in the figure below. But in fact this has no effect.
|
||||
|
@@ -264,10 +264,15 @@ jobs:
|
||||
| labels | 替换该 issue 的 labels | string | ✖ |
|
||||
| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
|
||||
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
||||
| allow-permissions | 允许操作的权限 | string | ✖ |
|
||||
|
||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
||||
- `labels`:优先级最高
|
||||
- `close-issue`:`true` 或 `'true'` 均可生效
|
||||
- `allow-permissions`:当不输时,即无限制。任何人评论都会触发。可选值有 `admin`,`write`,`read`,`none`
|
||||
- 团队成员若设置 read 权限,则为 read
|
||||
- 外部 Collaborator 若设置 read 权限,则为 read
|
||||
- 普通用户为 read 权限
|
||||
|
||||
<Alert>
|
||||
注意:使用简洁命令创建的 Duplicate 不显示下图红框内容。但其实这个没有任何影响的。
|
||||
|
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