File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232 run : uv run --group dev pytest
3333 - name : Run mypy
3434 run : uv run --group dev mypy .
35+ # For security reasons, PRs created from forks cannot generate PR comments directly
36+ # (see https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
37+ # Instead we need to trigger another workflow after this one completes.
38+ - name : Generate test coverage comment
39+ id : coverage_comment
40+ uses : py-cov-action/python-coverage-comment-action@v3
41+ with :
42+ GITHUB_TOKEN : ${{ github.token }}
43+ # Save the coverage comment for later use
44+ # See https://github.com/py-cov-action/python-coverage-comment-action/blob/main/README.md
45+ - name : Save coverage comment as an artifact
46+ uses : actions/upload-artifact@v4
47+ if : steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
48+ with :
49+ name : python-coverage-comment-action
50+ path : python-coverage-comment-action.txt
Original file line number Diff line number Diff line change 1+ ---
2+ name : Post test coverage GitHub comment
3+
4+ # Run workflow after test_code has completed
5+ on : # yamllint disable-line rule:truthy
6+ workflow_run :
7+ workflows : ["Run tests"]
8+ types :
9+ - completed
10+
11+ jobs :
12+ coverage :
13+ runs-on : ubuntu-latest
14+ if : github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
15+ permissions :
16+ # Gives the action the necessary permissions for publishing new
17+ # comments in pull requests.
18+ pull-requests : write
19+ # Gives the action the necessary permissions for editing existing
20+ # comments (to avoid publishing multiple comments in the same PR)
21+ contents : write
22+ # Gives the action the necessary permissions for looking up the
23+ # workflow that launched this workflow, and download the related
24+ # artifact that contains the comment to be published
25+ actions : read
26+ steps :
27+ # Post the pre-generated coverage comment
28+ - name : Post coverage comment
29+ uses : py-cov-action/python-coverage-comment-action@v3
30+ with :
31+ GITHUB_TOKEN : ${{ github.token }}
32+ GITHUB_PR_RUN_ID : ${{ github.event.workflow_run.id }}
You can’t perform that action at this time.
0 commit comments