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