mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-10-14 07:43:46 +08:00
refactor: add require-permission default (#51)
This commit is contained in:
@@ -403,12 +403,12 @@ jobs:
|
|||||||
| labels | Replace the labels of the issue | string | ✖ |
|
| labels | Replace the labels of the issue | string | ✖ |
|
||||||
| contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
|
| contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
|
||||||
| close-issue | Whether to close the issue at the same time | string | ✖ |
|
| close-issue | Whether to close the issue at the same time | string | ✖ |
|
||||||
| require-permission | Permission required | string | ✖ |
|
| require-permission | Permission required, default is `write` | string | ✖ |
|
||||||
|
|
||||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
|
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
|
||||||
- `labels`: Highest priority
|
- `labels`: Highest priority
|
||||||
- `close-issue`: Both `true` or `'true'` can take effect
|
- `close-issue`: Both `true` or `'true'` can take effect
|
||||||
- `require-permission`: When you do not input, there is no limit. Anyone comment will trigger. Optional values are `admin`, `write`, `read`, `none`
|
- `require-permission`: Optional values are `admin`, `write`, `read`, `none`
|
||||||
- If the team member sets the `read` permission, it is `read`
|
- If the team member sets the `read` permission, it is `read`
|
||||||
- If the external Collaborator is set to `read` permission, it is `read`
|
- If the external Collaborator is set to `read` permission, it is `read`
|
||||||
- Ordinary users have `read` permission
|
- Ordinary users have `read` permission
|
||||||
|
@@ -403,12 +403,12 @@ jobs:
|
|||||||
| labels | 替换该 issue 的 labels | string | ✖ |
|
| labels | 替换该 issue 的 labels | string | ✖ |
|
||||||
| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
|
| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
|
||||||
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
||||||
| require-permission | 要求权限 | string | ✖ |
|
| require-permission | 要求权限,默认为 `write` | string | ✖ |
|
||||||
|
|
||||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
||||||
- `labels`:优先级最高
|
- `labels`:优先级最高
|
||||||
- `close-issue`:`true` 或 `'true'` 均可生效
|
- `close-issue`:`true` 或 `'true'` 均可生效
|
||||||
- `require-permission`:当不输时,即无限制,任何人评论都会触发。可选值有 `admin`,`write`,`read`,`none`
|
- `require-permission`:可选值有 `admin`,`write`,`read`,`none`
|
||||||
- 团队成员若设置 `read` 权限,则为 `read`
|
- 团队成员若设置 `read` 权限,则为 `read`
|
||||||
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
|
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
|
||||||
- 普通用户为 `read` 权限
|
- 普通用户为 `read` 权限
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@@ -8020,7 +8020,7 @@ async function doMarkDuplicate(owner, repo, labels) {
|
|||||||
const duplicateLabels = core.getInput('duplicate-labels');
|
const duplicateLabels = core.getInput('duplicate-labels');
|
||||||
const removeLables = core.getInput('remove-labels');
|
const removeLables = core.getInput('remove-labels');
|
||||||
const closeIssue = core.getInput('close-issue');
|
const closeIssue = core.getInput('close-issue');
|
||||||
const requirePermission = core.getInput('require-permission');
|
const requirePermission = core.getInput('require-permission') || 'write';
|
||||||
|
|
||||||
const commentId = context.payload.comment.id;
|
const commentId = context.payload.comment.id;
|
||||||
const commentBody = context.payload.comment.body;
|
const commentBody = context.payload.comment.body;
|
||||||
@@ -8029,7 +8029,6 @@ async function doMarkDuplicate(owner, repo, labels) {
|
|||||||
|
|
||||||
const ifCommandInput = !!duplicateCommand;
|
const ifCommandInput = !!duplicateCommand;
|
||||||
|
|
||||||
if (requirePermission) {
|
|
||||||
const res = await octokit.repos.getCollaboratorPermissionLevel({
|
const res = await octokit.repos.getCollaboratorPermissionLevel({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
@@ -8040,7 +8039,6 @@ async function doMarkDuplicate(owner, repo, labels) {
|
|||||||
core.info(`The user ${commentUser} is not allow!`);
|
core.info(`The user ${commentUser} is not allow!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!commentBody.includes('?') &&
|
!commentBody.includes('?') &&
|
||||||
|
@@ -267,12 +267,12 @@ jobs:
|
|||||||
| labels | Replace the labels of the issue | string | ✖ |
|
| labels | Replace the labels of the issue | string | ✖ |
|
||||||
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | 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 | ✖ |
|
| close-issue | Whether to close the issue at the same time | string | ✖ |
|
||||||
| require-permission | Permission required | string | ✖ |
|
| require-permission | Permission required, default is `write` | string | ✖ |
|
||||||
|
|
||||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
|
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
|
||||||
- `labels`: Highest priority
|
- `labels`: Highest priority
|
||||||
- `close-issue`: Both `true` or `'true'` can take effect
|
- `close-issue`: Both `true` or `'true'` can take effect
|
||||||
- `require-permission`: When you do not input, there is no limit. Anyone comment will trigger. Optional values are `admin`, `write`, `read`, `none`
|
- `require-permission`: Optional values are `admin`, `write`, `read`, `none`
|
||||||
- If the team member sets the `read` permission, it is `read`
|
- If the team member sets the `read` permission, it is `read`
|
||||||
- If the external Collaborator is set to `read` permission, it is `read`
|
- If the external Collaborator is set to `read` permission, it is `read`
|
||||||
- Ordinary users have `read` permission
|
- Ordinary users have `read` permission
|
||||||
|
@@ -267,12 +267,12 @@ jobs:
|
|||||||
| labels | 替换该 issue 的 labels | string | ✖ |
|
| labels | 替换该 issue 的 labels | string | ✖ |
|
||||||
| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
|
| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
|
||||||
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
||||||
| require-permission | 要求权限 | string | ✖ |
|
| require-permission | 要求权限,默认为 `write` | string | ✖ |
|
||||||
|
|
||||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
||||||
- `labels`:优先级最高
|
- `labels`:优先级最高
|
||||||
- `close-issue`:`true` 或 `'true'` 均可生效
|
- `close-issue`:`true` 或 `'true'` 均可生效
|
||||||
- `require-permission`:当不输时,即无限制,任何人评论都会触发。可选值有 `admin`,`write`,`read`,`none`
|
- `require-permission`:可选值有 `admin`,`write`,`read`,`none`
|
||||||
- 团队成员若设置 `read` 权限,则为 `read`
|
- 团队成员若设置 `read` 权限,则为 `read`
|
||||||
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
|
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
|
||||||
- 普通用户为 `read` 权限
|
- 普通用户为 `read` 权限
|
||||||
|
@@ -157,7 +157,7 @@ async function doMarkDuplicate(owner, repo, labels) {
|
|||||||
const duplicateLabels = core.getInput('duplicate-labels');
|
const duplicateLabels = core.getInput('duplicate-labels');
|
||||||
const removeLables = core.getInput('remove-labels');
|
const removeLables = core.getInput('remove-labels');
|
||||||
const closeIssue = core.getInput('close-issue');
|
const closeIssue = core.getInput('close-issue');
|
||||||
const requirePermission = core.getInput('require-permission');
|
const requirePermission = core.getInput('require-permission') || 'write';
|
||||||
|
|
||||||
const commentId = context.payload.comment.id;
|
const commentId = context.payload.comment.id;
|
||||||
const commentBody = context.payload.comment.body;
|
const commentBody = context.payload.comment.body;
|
||||||
@@ -166,7 +166,6 @@ async function doMarkDuplicate(owner, repo, labels) {
|
|||||||
|
|
||||||
const ifCommandInput = !!duplicateCommand;
|
const ifCommandInput = !!duplicateCommand;
|
||||||
|
|
||||||
if (requirePermission) {
|
|
||||||
const res = await octokit.repos.getCollaboratorPermissionLevel({
|
const res = await octokit.repos.getCollaboratorPermissionLevel({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
@@ -177,7 +176,6 @@ async function doMarkDuplicate(owner, repo, labels) {
|
|||||||
core.info(`The user ${commentUser} is not allow!`);
|
core.info(`The user ${commentUser} is not allow!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!commentBody.includes('?') &&
|
!commentBody.includes('?') &&
|
||||||
|
Reference in New Issue
Block a user