MishaKav / pytest-coverage-comment

Comments a pull request with the pytest code coverage badge and full report

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Escape character seems to be failing the basic example

HagegeR opened this issue · comments

Hi, @MishaKav, thanks for your fantastic action!

I am trying to enable the badge update workflow and it did not work for me, so I tested each steps separately and got to here:

echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}"

Coverage Percentage - 82%
Coverage Color - green
Coverage Html - ""
/home/runner/_work/_temp/58ddf838-2bbf-44c9-b520-6d9de2814490.sh: line 4: syntax error near unexpected token `<'

My understanding is that the HTML result contains escape characters that the script doesn't know how to ignore.
It seems like the jest version you made have some improvements in that part of the code, is it possible to try and align their code base somehow maybe?

I also saw here another issue:

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

summary_report is not a valid id

Hoping to hear back from you soon :)

Hey,

  1. Try to run your example without printing echo "Coverage Html..." (just remove this line)
  2. You are right, instead of summary_report, it should be coverageComment (I've already update the main branch with that)

thanks for the swift response!
I actually need the Coverage Html because I wanted to use the example here:

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

you can still use the HTML response in this line

sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n\${{ steps.coverageComment.outputs.content }}\n<!-- Pytest Coverage Comment:End -->' ./README.md

Try to remove the "echo" line with "HTML"

echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}"

I'll try this, btw the first link you sent also use the wrong id

outputs.content is not valid, did you mean outputs.coverageHtml? I get an empty result from outputs.content

Yes, I mean, just remove this line

echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}" 

I tried many things, in the end the only thing that worked was using ${{ steps.coverageComment.outputs.summaryReport }}
it adds "" that I don't need, but the content is here at least

Thanks for sharing