Skip to content

Codecov for pull requests #898

Codecov for pull requests

Codecov for pull requests #898

Workflow file for this run

name: Codecov for pull requests
on:
workflow_run:
workflows:
# Triggered by the Continuous Integration workflow
- Continuous Integration
types:
# Only when the Continuous Integration workflow completes
- completed
permissions:
# Read the contents of the repo
contents: read
jobs:
coverage:
runs-on: ubuntu-latest
# Only run if the Continuous Integration workflow was successful
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Check out the same ref that Continuous Integration ran for
ref: ${{ github.event.workflow_run.head_sha }}
# Make sure that history is available to Codecov
fetch-depth: 0
- name: Install pnpm package manager
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Setup Node.js version and cache
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: .nvmrc
- name: Check for known security issues with npm packages
run: |
echo "Auditing npm dependencies before installing them. For more information, see: https://nldesignsystem.nl/pnpm-audit"
pnpm audit --audit-level critical
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download coverage-report artifact
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: coverage-report
# Needed to download an artifact created in a different workflow
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
- name: Upload coverage to codecov.io
id: codecov-action
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
fail_ci_if_error: true
override_commit: ${{ github.event.workflow_run.head_sha }}
override_pr: ${{ github.event.workflow_run.pull_requests[0].number }}
token: ${{ secrets.CODECOV_TOKEN }}