coverage report #101
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: coverage report | |
| on: | |
| workflow_run: | |
| workflows: | |
| - quality checks | |
| types: | |
| - completed | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| actions: read | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.event == 'pull_request' }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Download coverage artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: coverage | |
| path: coverage | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: coverage output | |
| id: coverage | |
| shell: bash | |
| run: | | |
| { | |
| echo "body<<EOF" | |
| bunx lcov-summary "${GITHUB_WORKSPACE}/coverage/lcov.info" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: merge request id | |
| id: merge-request | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| id=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }} --jq '.pull_requests[0].number') | |
| echo "number=$id" >> "$GITHUB_OUTPUT" | |
| - name: coverage report | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| number: ${{ steps.merge-request.outputs.number }} | |
| header: Coverage Report | |
| message: | | |
| ### Coverage Report | |
| ``` | |
| ${{ steps.coverage.outputs.body }} | |
| ``` |