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
dd915277b4
commit
ba572be88f
1 changed files with 9 additions and 3 deletions
12
index.js
12
index.js
|
|
@ -67,11 +67,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