| 1 |
# .github/workflows/coverage.yml |
| 2 |
name: Post coverage comment |
| 3 |
|
| 4 |
on: |
| 5 |
workflow_run: |
| 6 |
workflows: ["Tests"] |
| 7 |
types: |
| 8 |
- completed |
| 9 |
|
| 10 |
jobs: |
| 11 |
test: |
| 12 |
name: Run tests & display 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 |
# DO NOT run actions/checkout here, for security reasons |
| 28 |
# For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ |
| 29 |
- name: Post comment |
| 30 |
uses: py-cov-action/python-coverage-comment-action@v3 |
| 31 |
with: |
| 32 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 33 |
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }} |