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 4
4
workflows : ["UnitTests"]
5
5
types :
6
6
- completed
7
- workflow_dispatch :
8
7
9
8
jobs :
10
9
test :
11
10
name : Run tests & display coverage
12
11
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'
15
12
permissions :
16
13
pull-requests : write
17
14
contents : write
18
15
actions : read
19
16
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
+
20
28
- name : Post comment
29
+ if : steps.check.outputs.should_run == 'true'
21
30
uses : py-cov-action/python-coverage-comment-action@v3
22
31
with :
23
32
GITHUB_PR_RUN_ID : ${{ github.event.workflow_run.id }}
You can’t perform that action at this time.
0 commit comments