Skip to content

Commit

Permalink
Summary report fix (#35)
Browse files Browse the repository at this point in the history
* add JSON.stringify to summaryReport

* update "Update Coverage on Readme"
  • Loading branch information
MishaKav authored Nov 10, 2021
1 parent b8d6c8c commit 672d019
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/update-coverage-on-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ jobs:
with:
hide-comment: true
pytest-coverage-path: ./data/pytest-coverage_4.txt
junitxml-path: ./data/pytest_1.xml

- name: Create Variable of Summary Report
id: summary_report
run: |
SUMMARY_REPORT=${{ steps.coverageComment.outputs.summaryReport }}
echo "::set-output name=content::$SUMMARY_REPORT"
- name: Update Readme with Coverage Html
if: ${{ github.ref == 'refs/heads/main' }}
run: |
sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n\${{ steps.coverageComment.outputs.coverageHtml }}\n<!-- Pytest Coverage Comment:End -->' ./README.md
sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n\${{ steps.summary_report.outputs.content }}\n<!-- Pytest Coverage Comment:End -->' ./README.md
- name: Commit & Push changes to Readme
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13599,7 +13599,7 @@ const main = async () => {

if (multipleFiles && multipleFiles.length) {
finalHtml += getMultipleReport(options);
core.setOutput('summaryReport', finalHtml);
core.setOutput('summaryReport', JSON.stringify(finalHtml));
} else {
let report = getCoverageReport(options);
const { coverage, color, html, warnings } = report;
Expand All @@ -13623,7 +13623,7 @@ const main = async () => {

const notSuccessTestInfo = getNotSuccessTest(options);
core.setOutput('notSuccessTestInfo', JSON.stringify(notSuccessTestInfo));
core.setOutput('summaryReport', summaryReport);
core.setOutput('summaryReport', JSON.stringify(summaryReport));
}

if (html.length + summaryReport.length > MAX_COMMENT_LENGTH) {
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const main = async () => {

if (multipleFiles && multipleFiles.length) {
finalHtml += getMultipleReport(options);
core.setOutput('summaryReport', finalHtml);
core.setOutput('summaryReport', JSON.stringify(finalHtml));
} else {
let report = getCoverageReport(options);
const { coverage, color, html, warnings } = report;
Expand All @@ -83,7 +83,7 @@ const main = async () => {

const notSuccessTestInfo = getNotSuccessTest(options);
core.setOutput('notSuccessTestInfo', JSON.stringify(notSuccessTestInfo));
core.setOutput('summaryReport', summaryReport);
core.setOutput('summaryReport', JSON.stringify(summaryReport));
}

if (html.length + summaryReport.length > MAX_COMMENT_LENGTH) {
Expand Down

0 comments on commit 672d019

Please sign in to comment.