Skip to content

Commit 6f0fcf0

Browse files
authored
Update coverage.yml (#327)
* Update coverage.yml * Update coverage.yml
1 parent c395497 commit 6f0fcf0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/coverage.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@ on:
44
workflows: ["UnitTests"]
55
types:
66
- completed
7-
workflow_dispatch:
87

98
jobs:
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 }}

0 commit comments

Comments
 (0)