diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 156e293..b3e0486 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,9 +94,12 @@ jobs: - name: Comment on pull request run: | - COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments -q '.[] | select(.user.login=="github-actions[bot]") | .id' | head -n 1) + COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments -q '.[] | select(.user.login=="github-actions[bot]" and (.body | test("Coverage Δ")) )' | head -n 1) if [ -z "$COMMENT_ID" ]; then - gh pr comment ${{ github.event.number }} --body-file=coverage-comment.md + echo "Creating new coverage report comment" else - gh pr comment ${{ github.event.number }} --body-file=coverage-comment.md --edit-last + echo "Replacing old coverage report comment (ID: $COMMENT_ID)" + gh api -X DELETE repos/${{ github.repository }}/issues/comments/$COMMENT_ID fi + + gh pr comment ${{ github.event.number }} --body-file=coverage-comment.md