diff --git a/README.en-US.md b/README.en-US.md index d71e6a8..2ff330a 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -391,7 +391,7 @@ jobs: | contents | Add [reaction](#reactions-types) for this comment | 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 - `close-issue`: Both `true` or `'true'` can take effect diff --git a/README.md b/README.md index 5d0a9e8..c7257dd 100644 --- a/README.md +++ b/README.md @@ -391,7 +391,7 @@ jobs: | contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ | | close-issue | 是否同时关闭该 issue | string | ✖ | -- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of` +- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?` - `labels`:优先级最高 - `close-issue`:`true` 或 `'true'` 均可生效 diff --git a/dist/index.js b/dist/index.js index 5fbe4ec..1a1657d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -8042,7 +8042,7 @@ async function doMarkDuplicate (owner, repo, labels) { 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) { const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of'); await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true); @@ -8074,7 +8074,7 @@ async function doMarkDuplicate (owner, repo, labels) { await doCloseIssue(owner, repo, issueNumber); } } 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) { if (!body || !body.startsWith('Duplicate of')) { - return false + return false; } let arr = body.split(' '); diff --git a/docs/base.en-US.md b/docs/base.en-US.md index 0ba3e97..0f6a19b 100644 --- a/docs/base.en-US.md +++ b/docs/base.en-US.md @@ -265,7 +265,7 @@ jobs: | 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 | ✖ | -- `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 - `close-issue`: Both `true` or `'true'` can take effect diff --git a/docs/base.md b/docs/base.md index e1708b0..cb7a545 100644 --- a/docs/base.md +++ b/docs/base.md @@ -265,7 +265,7 @@ jobs: | contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | | close-issue | 是否同时关闭该 issue | string | ✖ | -- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of` +- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?` - `labels`:优先级最高 - `close-issue`:`true` 或 `'true'` 均可生效 diff --git a/src/base.js b/src/base.js index 660537d..2d2a1bc 100644 --- a/src/base.js +++ b/src/base.js @@ -171,7 +171,7 @@ async function doMarkDuplicate (owner, repo, labels) { 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) { const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of'); await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true); @@ -203,7 +203,7 @@ async function doMarkDuplicate (owner, repo, labels) { await doCloseIssue(owner, repo, issueNumber); } } 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 '?'`); } }; diff --git a/src/util.js b/src/util.js index c728fc1..10c9b1a 100644 --- a/src/util.js +++ b/src/util.js @@ -31,7 +31,7 @@ function matchKeyword (content, keywords) { function testDuplicate(body) { if (!body || !body.startsWith('Duplicate of')) { - return false + return false; } let arr = body.split(' ');