mirror of
https://github.com/mshick/add-pr-comment.git
synced 2025-12-31 14:20:32 +11:00
fix: remove spaces when doing existing comment comparison
This commit is contained in:
parent
ba572be88f
commit
4d887b477c
1 changed files with 9 additions and 3 deletions
12
dist/index.js
vendored
12
dist/index.js
vendored
|
|
@ -2054,11 +2054,17 @@ async function run() {
|
|||
issue_number: issueNumber,
|
||||
});
|
||||
|
||||
const filteredComments = comments.filter(
|
||||
(c) => c.body === message && c.user.login === "github-actions[bot]"
|
||||
const spacesRe = new RegExp("\\s", "g");
|
||||
const messageClean = message.replace(spacesRe, "");
|
||||
|
||||
const commentExists = comments.some(
|
||||
(c) =>
|
||||
// First find candidate bot messages to avoid extra processing(
|
||||
c.user.login === "github-actions[bot]" &&
|
||||
c.body.replace(spacesRe, "") === messageClean
|
||||
);
|
||||
|
||||
if (filteredComments.length) {
|
||||
if (commentExists) {
|
||||
core.info("the issue already contains this message");
|
||||
core.setOutput("comment-created", "false");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue