Debian Codegraph @

.github/workflows/coverage.yml

raw
1 name: Coverage comment, status & badge
2
3 on: # zizmor: ignore[dangerous-triggers]
4 workflow_run:
5 workflows: [CI]
6 types:
7 - completed
8
9 permissions:
10 contents: read
11
12 jobs:
13 coverage-comment:
14 runs-on: ubuntu-latest
15 if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
16 permissions:
17 # Gives the action the necessary permissions for publishing new
18 # comments in pull requests.
19 pull-requests: write
20 # Gives the action the necessary permissions for editing existing
21 # comments (to avoid publishing multiple comments in the same PR)
22 contents: write
23 # Gives the action the necessary permissions for looking up the
24 # workflow that launched this workflow, and download the related
25 # artifact that contains the comment to be published
26 actions: read
27 steps:
28 # DO NOT run actions/checkout here, for security reasons
29 # For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
30 - name: Post comment
31 uses: py-cov-action/python-coverage-comment-action@5d8df5979747514c914e1c5a12335a7cf9a2745f # v4.1
32 with:
33 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
35
36 coverage-status-badge:
37 runs-on: ubuntu-latest
38
39 permissions:
40 # smokeshow permissions to set commit status:
41 statuses: write
42
43 environment:
44 name: coverage
45
46 steps:
47 - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
48 with:
49 enable-cache: true
50 python-version: '3.14'
51
52 - uses: dawidd6/action-download-artifact@b6e2e70617bc3265edd6dab6c906732b2f1ae151 # v21
53 with:
54 workflow: ci.yml
55 name: 'coverage-html'
56 path: 'coverage-html'
57 allow_forks: true
58 commit: ${{ github.event.workflow_run.head_sha }}
59
60 - run: uvx smokeshow upload coverage-html
61 env:
62 SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
63 SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 85
64 SMOKESHOW_GITHUB_CONTEXT: coverage
65 SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66 SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
67 SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}