Skip to content

Commit 1da009c

Browse files
mostafaNazari702Google Gemini
andauthored
ci: only run coverage steps when the tests actually ran (#6262)
Co-authored-by: Google Gemini <noreply@google.com>
1 parent 9593caa commit 1da009c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/npm-script.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ jobs:
6767
node-version: ${{ matrix.node_version }}
6868
cache: "npm"
6969
- run: npm ci --ignore-scripts
70-
- run: npm run ${{ inputs.npm-script }}
70+
- id: npm-script
71+
run: npm run ${{ inputs.npm-script }}
7172
env:
7273
BROWSER: ${{ matrix.browser }}
7374
COVERAGE: ${{ inputs.coverage && '1'}}
7475
NODE_OPTIONS: "--trace-warnings"
75-
# Generate and upload coverage, even if tests fail
7676
- name: Generate coverage report
77-
if: always() && inputs.coverage
77+
if: ${{ !cancelled() && inputs.coverage && (steps.npm-script.conclusion == 'success' || steps.npm-script.conclusion == 'failure') }}
7878
run: npm run test-coverage-generate
7979
# https://github.com/marketplace/actions/codecov
8080
# https://app.codecov.io/gh/mochajs/mocha
8181
- name: Upload coverage reports
82-
if: always() && inputs.coverage
82+
if: ${{ !cancelled() && inputs.coverage && (steps.npm-script.conclusion == 'success' || steps.npm-script.conclusion == 'failure') }}
8383
uses: codecov/codecov-action@v7
8484
with:
8585
fail_ci_if_error: true

0 commit comments

Comments
 (0)