Last active
July 6, 2022 02:16
-
-
Save shu-yusa/262afa2859a964e0d8bf5fac4df7a087 to your computer and use it in GitHub Desktop.
Convert Python coverage output to GitHub Actions job summary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary | |
repo_url=https://github.com/your-user-id/your-repository/blob | |
branch=master | |
coverage report | sed "1,3 s/-\+/--|--|--|--/g" | \ | |
sed "/-\{3\}/d"| \ | |
sed "0,/TOTAL*/ s/ \+/|/g" | \ | |
sed "0,/TOTAL*/ s/^/|/g" | \ | |
sed "0,/TOTAL*/ s/$/|/g" | \ | |
sed "1i # Test Coverage" | \ | |
sed "s#|\(.\+\.py\)|#|[\1]($repo_url/$branch/\1)|#g" >> $GITHUB_STEP_SUMMARY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment