Skip to content

Commit

Permalink
Delete old coverage report comment instead of updating it in place
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrosse committed Mar 11, 2024
1 parent 191f977 commit 0c6d062
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0c6d062

Please sign in to comment.