From df5b76b108b9b5afaeaa5bb79769af15b41d7c36 Mon Sep 17 00:00:00 2001 From: sdobbert Date: Wed, 26 Jun 2024 18:02:24 +0200 Subject: [PATCH] ci: make sure to get first comment --- .github/workflows/on-pull-request.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 409456e6c..c51975973 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -67,9 +67,9 @@ jobs: run: | COMMENT="⚠️ No tests were found related to the files changed since the last commit." PR_NUMBER=${{ github.event.pull_request.number }} - COVERAGE_COMMENT_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" | \ - jq -r '.[] | select(.user.login == "github-actions[bot]") | .id') + COMMENTS_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments") + COVERAGE_COMMENT_ID=$(echo "${COMMENTS_JSON}" | jq -r 'map(select(.user.login == "github-actions[bot]")) | sort_by(.created_at) | .[0].id') echo "COVERAGE_COMMENT_ID: ${COVERAGE_COMMENT_ID}" if [ -z "$COVERAGE_COMMENT_ID" ]; then