Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PR comment with code coverage #59

Merged
merged 14 commits into from
May 3, 2024
Merged
20 changes: 16 additions & 4 deletions .github/workflows/frameworkTesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,25 @@ jobs:
badge: true
format: 'markdown'
output: 'file'

# Source: https://stackoverflow.com/a/70655285
- name: Read coverage report to variable
id: read_md
run: |
echo 'COV_MD<<EOF' >> $GITHUB_OUTPUT
echo "$(cat code-coverage-results.md)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT

- name: Add code coverage PR comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
recreate: true
path: code-coverage-results.md
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${{ steps.read_md.outputs.COV_MD }}`
})

- name: Write to job summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
Expand Down