Comment coverage on PR #1375
This file contains hidden or 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
| name: 'Comment coverage on PR' | |
| on: | |
| workflow_run: | |
| workflows: ['🧪'] | |
| types: | |
| - completed | |
| permissions: | |
| actions: read | |
| contents: read | |
| jobs: | |
| coverage: | |
| permissions: | |
| pull-requests: write | |
| if: >- | |
| ${{ | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.head_repository.full_name == github.repository | |
| }} | |
| env: | |
| unique_id: <!-- coverage-report --> | |
| name: Coverage reporting | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout actions | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| sparse-checkout: | | |
| .github | |
| persist-credentials: false | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: coverage-vitest | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| path: ${{ runner.temp }}/artifacts | |
| - name: Build the report | |
| id: report | |
| run: | | |
| echo "\`\`\`" > ./cov.txt | |
| cat ${{ runner.temp }}/artifacts/coverage-summary.txt >> ./cov.txt | |
| echo "\`\`\`" >> ./cov.txt | |
| echo "${{ env.unique_id }}" >> ./cov.txt | |
| - name: Comment on PR for coverage | |
| uses: ./.github/actions/find-create-or-update-comment | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| issue-number: ${{ github.event.workflow_run.pull_requests[0].number }} | |
| body-includes: '${{ env.unique_id }}' | |
| comment-author: 'github-actions[bot]' | |
| body-path: ./cov.txt | |
| edit-mode: replace |