Skip to content

Commit

Permalink
Update comment_coverage_report.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Rd4dev authored Oct 15, 2024
1 parent 05f23ef commit 5ee7e10
Showing 1 changed file with 10 additions and 59 deletions.
69 changes: 10 additions & 59 deletions .github/workflows/comment_coverage_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Find Comment Cov Rep
- name: Find the last Coverage Report
uses: peter-evans/find-comment@v3
id: fc-cr
id: last-coverage-report
with:
issue-number: 39
issue-number: ${{ github.event.pull_request.number }}
body-includes: Coverage Report
direction: last
- run: |
echo "${{ steps.fc-cr.outputs.comment-body }}"
echo "${{ steps.last-coverage-report.outputs.comment-body }}" > comment.md
- name: Find CI workflow run for PR
id: find-workflow-run
Expand Down Expand Up @@ -83,73 +83,24 @@ jobs:
name: final-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ steps.find-workflow-run.outputs.run-id }}

- name: Uhm. lets see if this works
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: 'CoverageReport.md'

- name: Save the comment body to file
run: |
echo "${{ steps.fc-cr.outputs.comment-body }}" > comment.md

- name: Compare coverage report with the comment body (workkkkk!!)
run: |
sed -i -e '$a\' CoverageReport.md
sed -i -e '$a\' comment.md
if diff CoverageReport.md comment.md > /dev/null; then
echo "No significant changes detected; skipping comment."
echo "skip_comment=true" >> $GITHUB_ENV
else
echo "Changes detected; proceeding with the comment."
echo "skip_comment=false" >> $GITHUB_ENV
fi
if diff CoverageReport.md comment.md; then
echo "No significant changes detected; skipping comment."
echo "skip_comment=true" >> $GITHUB_ENV
echo "No significant changes detected; skipping coverage comment."
echo "skip_coverage_comment=true" >> $GITHUB_ENV
else
echo "Changes detected; displaying the differences:"
diff CoverageReport.md comment.md
echo "skip_comment=false" >> $GITHUB_ENV
echo "Changes detected; proceeding with the coverage comment."
echo "skip_coverage_comment=false" >> $GITHUB_ENV
fi
- name: Upload Coverage Report as PR Comment
if: ${{ env.skip_coverage_comment == 'false' }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: 'CoverageReport.md'
- run: |
echo "${{ steps.fc-cr.outputs.comment-body }}" > comment.md
# echo "Content of CoverageReport.md:"
# echo $(cat CoverageReport.md)
# echo "Content of comment.md:"
# echo $(cat comment.md)
if diff CoverageReport.md comment.md > /dev/null; then
echo "No significant changes detected; skipping comment."
echo "skip_comment=true" >> $GITHUB_ENV
else
echo "Changes detected; proceeding with the comment."
echo "skip_comment=false" >> $GITHUB_ENV
fi
# echo "$(cat CoverageReport.md)"
# if diff $(cat CoverageReport.md) ${{ steps.fc-cr.outputs.comment-body }} > /dev/null; then
# echo "No significant changes detected; skipping comment."
# echo "skip_comment=true" >> $GITHUB_ENV
# else
# echo "Changes detected; proceeding with the comment."
# echo "skip_comment=false" >> $GITHUB_ENV
# fi
# if [[ "$(cat CoverageReport.md)" == "${{ steps.fc-cr.outputs.comment-body }}" ]]; then
# echo "same"
# else
# echo "not same"
# fi

0 comments on commit 5ee7e10

Please sign in to comment.