mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-20 10:46:03 +08:00
feat: add question mark duplicate (#38)
* feat: add question mark duplicate * add package * add * up * up
This commit is contained in:
@@ -391,7 +391,7 @@ jobs:
|
|||||||
| 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 | ✖ |
|
||||||
|
|
||||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`
|
- `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
|
||||||
|
|
||||||
|
@@ -391,7 +391,7 @@ jobs:
|
|||||||
| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
|
| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
|
||||||
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
||||||
|
|
||||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`
|
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
||||||
- `labels`:优先级最高
|
- `labels`:优先级最高
|
||||||
- `close-issue`:`true` 或 `'true'` 均可生效
|
- `close-issue`:`true` 或 `'true'` 均可生效
|
||||||
|
|
||||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
@@ -8042,7 +8042,7 @@ async function doMarkDuplicate (owner, repo, labels) {
|
|||||||
|
|
||||||
const ifCommandInput = !!duplicateCommand;
|
const ifCommandInput = !!duplicateCommand;
|
||||||
|
|
||||||
if ((ifCommandInput && commentBody.startsWith(duplicateCommand) && commentBody.split(' ')[0] == duplicateCommand) || testDuplicate(commentBody)) {
|
if (!commentBody.includes('?') && ((ifCommandInput && commentBody.startsWith(duplicateCommand) && commentBody.split(' ')[0] == duplicateCommand) || testDuplicate(commentBody))) {
|
||||||
if (ifCommandInput) {
|
if (ifCommandInput) {
|
||||||
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
|
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
|
||||||
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
|
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
|
||||||
@@ -8074,7 +8074,7 @@ async function doMarkDuplicate (owner, repo, labels) {
|
|||||||
await doCloseIssue(owner, repo, issueNumber);
|
await doCloseIssue(owner, repo, issueNumber);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
core.info(`This comment body should start whith 'duplicate-command'`);
|
core.info(`This comment body should start whith 'duplicate-command' or 'Duplicate of' and not include '?'`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -8732,7 +8732,7 @@ function matchKeyword (content, keywords) {
|
|||||||
|
|
||||||
function testDuplicate(body) {
|
function testDuplicate(body) {
|
||||||
if (!body || !body.startsWith('Duplicate of')) {
|
if (!body || !body.startsWith('Duplicate of')) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let arr = body.split(' ');
|
let arr = body.split(' ');
|
||||||
|
@@ -265,7 +265,7 @@ jobs:
|
|||||||
| 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 | ✖ |
|
||||||
|
|
||||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`
|
- `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
|
||||||
|
|
||||||
|
@@ -265,7 +265,7 @@ jobs:
|
|||||||
| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
|
| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
|
||||||
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
||||||
|
|
||||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`
|
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
||||||
- `labels`:优先级最高
|
- `labels`:优先级最高
|
||||||
- `close-issue`:`true` 或 `'true'` 均可生效
|
- `close-issue`:`true` 或 `'true'` 均可生效
|
||||||
|
|
||||||
|
@@ -171,7 +171,7 @@ async function doMarkDuplicate (owner, repo, labels) {
|
|||||||
|
|
||||||
const ifCommandInput = !!duplicateCommand;
|
const ifCommandInput = !!duplicateCommand;
|
||||||
|
|
||||||
if ((ifCommandInput && commentBody.startsWith(duplicateCommand) && commentBody.split(' ')[0] == duplicateCommand) || testDuplicate(commentBody)) {
|
if (!commentBody.includes('?') && ((ifCommandInput && commentBody.startsWith(duplicateCommand) && commentBody.split(' ')[0] == duplicateCommand) || testDuplicate(commentBody))) {
|
||||||
if (ifCommandInput) {
|
if (ifCommandInput) {
|
||||||
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
|
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
|
||||||
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
|
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
|
||||||
@@ -203,7 +203,7 @@ async function doMarkDuplicate (owner, repo, labels) {
|
|||||||
await doCloseIssue(owner, repo, issueNumber);
|
await doCloseIssue(owner, repo, issueNumber);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
core.info(`This comment body should start whith 'duplicate-command'`);
|
core.info(`This comment body should start whith 'duplicate-command' or 'Duplicate of' and not include '?'`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ function matchKeyword (content, keywords) {
|
|||||||
|
|
||||||
function testDuplicate(body) {
|
function testDuplicate(body) {
|
||||||
if (!body || !body.startsWith('Duplicate of')) {
|
if (!body || !body.startsWith('Duplicate of')) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let arr = body.split(' ');
|
let arr = body.split(' ');
|
||||||
|
Reference in New Issue
Block a user