|
| 1 | +name: Codecov for pull requests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: |
| 6 | + - Continuous Deployment |
| 7 | + types: |
| 8 | + - completed |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + coverage: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 20 | + with: |
| 21 | + ref: ${{ github.event.workflow_run.head_sha }} |
| 22 | + # Make sure that history is available to Codecov |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Install pnpm package manager |
| 26 | + uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 |
| 27 | + |
| 28 | + - name: Setup Node.js version and cache |
| 29 | + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 |
| 30 | + with: |
| 31 | + node-version-file: .nvmrc |
| 32 | + |
| 33 | + - name: Check for known security issues with npm packages |
| 34 | + run: | |
| 35 | + echo "Auditing npm dependencies before installing them. For more information, see: https://nldesignsystem.nl/pnpm-audit" |
| 36 | + pnpm audit --audit-level critical |
| 37 | +
|
| 38 | + - name: Install dependencies |
| 39 | + run: pnpm install --frozen-lockfile |
| 40 | + |
| 41 | + - name: Download coverage-report artifact |
| 42 | + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 |
| 43 | + with: |
| 44 | + name: coverage-report |
| 45 | + # Needed to download an artifact created in a different workflow |
| 46 | + github-token: ${{ github.token }} |
| 47 | + run-id: ${{ github.event.workflow_run.id }} |
| 48 | + |
| 49 | + - name: Upload coverage to codecov.io |
| 50 | + id: codecov-action |
| 51 | + uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 |
| 52 | + with: |
| 53 | + fail_ci_if_error: true |
| 54 | + override_commit: ${{ github.event.workflow_run.head_sha }} |
| 55 | + override_pr: ${{ github.event.workflow_run.pull_requests[0].number }} |
| 56 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments