From 3c094f55852f322e22f8446b61caebee6f30ddc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 8 Nov 2021 14:54:29 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F=20Fix?= =?UTF-8?q?=20comment=20detection=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue_automation.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/issue_automation.yml b/.github/workflows/issue_automation.yml index 40a89ba60..3e5b9e016 100644 --- a/.github/workflows/issue_automation.yml +++ b/.github/workflows/issue_automation.yml @@ -109,6 +109,11 @@ jobs: issue_number: context.issue.number, }) const comment = comments.data.find(c => c.user.login === "github-actions[bot]" && c.body.includes(marker)); + if (comment) { + console.log("Found comment, id=" + comment.id); + } else { + console.log("No comment found"); + } if (!labels.includes("triage") || labels.includes("approved")) { console.log("Deleting comment if it exists..."); @@ -127,20 +132,20 @@ jobs: if (!found) { console.log("No bundle found, posting/updating reminder"); const text = REMINDER + "\n" + marker; - if (comment && comment.body !== text) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: comment.id, - body: text - }); - } else { + if (!comment) { await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body: text }); + } else if (comment.body !== text) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id, + body: text + }); } } else if (found && comment) { console.log("Bundle found, saying thanks");