-
Notifications
You must be signed in to change notification settings - Fork 31
34 lines (32 loc) · 1.04 KB
/
coverage.yml
File metadata and controls
34 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Post coverage comment
on:
workflow_run:
workflows: ["Testing"]
types:
- completed
jobs:
test:
name: Run tests & display coverage
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
actions: read
steps:
- name: Check if should run
id: check
run: |
if [[ "${{ github.event.workflow_run.event }}" == "pull_request" ]] && [[ "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
echo "✅ Running coverage comment for PR"
else
echo "should_run=false" >> $GITHUB_OUTPUT
echo "✅ Skipping - not a PR event (event: ${{ github.event.workflow_run.event }})"
fi
- name: Post comment
if: steps.check.outputs.should_run == 'true'
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}