Skip to content

Commit

Permalink
feat: add coverage report comment to PR.
Browse files Browse the repository at this point in the history
  • Loading branch information
siavashyj committed Jun 22, 2024
1 parent a0d8e5a commit 86f55f7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/test-and-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,18 @@ jobs:
cd youtube-playlist-downloader
poetry run coverage run -m pytest
poetry run coverage report
poetry run coverage report > coverage_report.txt
- name: Post coverage comment
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs')
const coverageReport = fs.readFileSync('youtube-playlist-downloader/coverage_report.txt', 'utf8')
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.name,
body: '## Coverage Report\n```\n' + coverageReport + '\n```'
})

0 comments on commit 86f55f7

Please sign in to comment.