feat: add question mark duplicate (#38)

* feat: add question mark duplicate

* add package

* add

* up

* up
This commit is contained in:
xrkffgg
2021-01-13 09:32:46 +08:00
committed by GitHub
parent 273b6abb78
commit c7cf5de709
7 changed files with 10 additions and 10 deletions

View File

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

View File

@@ -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
View File

@@ -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(' ');

View File

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

View File

@@ -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'` 均可生效

View File

@@ -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 '?'`);
} }
}; };

View File

@@ -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(' ');