File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 44 workflows : ["UnitTests"]
55 types :
66 - completed
7- workflow_dispatch :
87
98jobs :
109 test :
1110 name : Run tests & display coverage
1211 runs-on : ubuntu-latest
13- # This ensures it ONLY runs on PR events, not pushes to main
14- if : github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
1512 permissions :
1613 pull-requests : write
1714 contents : write
1815 actions : read
1916 steps :
17+ - name : Check if should run
18+ id : check
19+ run : |
20+ if [[ "${{ github.event.workflow_run.event }}" == "pull_request" ]] && [[ "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then
21+ echo "should_run=true" >> $GITHUB_OUTPUT
22+ echo "✅ Running coverage comment for PR"
23+ else
24+ echo "should_run=false" >> $GITHUB_OUTPUT
25+ echo "✅ Skipping - not a PR event (event: ${{ github.event.workflow_run.event }})"
26+ fi
27+
2028 - name : Post comment
29+ if : steps.check.outputs.should_run == 'true'
2130 uses : py-cov-action/python-coverage-comment-action@v3
2231 with :
2332 GITHUB_PR_RUN_ID : ${{ github.event.workflow_run.id }}
You can’t perform that action at this time.
0 commit comments