From 99ffb55ef08ddde740d6bf02ae2d0a76f4e6f84b Mon Sep 17 00:00:00 2001 From: jennyf19 Date: Sat, 4 Jan 2025 14:44:57 -0800 Subject: [PATCH] fixed #2983 and re-add code coverage comments to PRs --- .github/workflows/dotnetcore.yml | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index cffc3d5bba..8807853e1c 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -49,28 +49,27 @@ jobs: - name: Create code coverage report run: | dotnet tool install -g dotnet-reportgenerator-globaltool --version 5.4.1 - reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:CodeCoverage -reporttypes:'MarkdownSummaryGithub;Cobertura' + reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:CodeCoverage -reporttypes:'MarkdownSummaryGithub;Cobertura' -filefilters:'+src/**/*.cs' - name: Write coverage to job summary shell: bash run: | cat CodeCoverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY - # Temporarily disable commenting the coverage report - # echo "COMMENT_CONTENT_ENV_VAR<> $GITHUB_ENV - # echo $(cat CodeCoverage/SummaryGithub.md) >> $GITHUB_ENV - # echo "EOF" >> $GITHUB_ENV + echo "COMMENT_CONTENT_ENV_VAR<> $GITHUB_ENV + echo $(cat CodeCoverage/SummaryGithub.md) >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV - # - name: Comment coverage in PR - # uses: actions/github-script@v7 - # id: comment - # with: - # script: | - # github.rest.issues.createComment({ - # issue_number: context.issue.number, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: process.env.COMMENT_CONTENT_ENV_VAR - # }) + - name: Comment coverage in PR + uses: actions/github-script@v7 + id: comment + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: process.env.COMMENT_CONTENT_ENV_VAR + }) # Run baseline package validation - name: Pack