From 8c58c23fddf66c3ba7e5d00521fd3710747643a4 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Fri, 18 Mar 2022 22:25:16 -0700 Subject: [PATCH] Fix previous comment finding. --- .github/workflows/pr_build_comment.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_build_comment.yml b/.github/workflows/pr_build_comment.yml index 2a2944e2475..17394222e82 100644 --- a/.github/workflows/pr_build_comment.yml +++ b/.github/workflows/pr_build_comment.yml @@ -73,7 +73,7 @@ jobs: let comment; let page = 1 while (!comment) { - const comments = github.rest.issues.listComments({ + const comments = await github.rest.issues.listComments({ issue_number: ${{steps.pr-number.outputs.result}}, owner: context.repo.owner, repo: context.repo.repo, @@ -82,10 +82,12 @@ jobs: if (!comments.length) { return; } - comment = comments.find(c => c.body.includes('[**Build Artifacts**]')) + comment = comments.find(c => c.body && c.body.includes('[**Build Artifacts**]')) + if (comment) { + return comment.id.toString() + } page += 1; } - return comment && comment.id - name: Create build comment if: ${{!steps.find-comment.outputs.result}} uses: actions/github-script@v6