|
9 | 9 | workflow_dispatch: |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - coverage: |
| 12 | + coverage-comment-raw: |
| 13 | + name: 📝 PR Raw Coverage Table |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + pull-requests: write |
| 17 | + contents: read |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - name: Install dependencies |
| 21 | + run: npm ci |
| 22 | + |
| 23 | + - name: Run coverage and extract table |
| 24 | + run: | |
| 25 | + npm run test:coverage > full-coverage.txt || true |
| 26 | + sed -n '/^-------------------------|---------|----------|---------|---------|/,$p' full-coverage.txt | \ |
| 27 | + sed '/^=============================== Coverage summary ===============================/,$d' | \ |
| 28 | + # Remove first and last border lines: |
| 29 | + sed '1d;$d' > coverage-table.txt |
| 30 | +
|
| 31 | + - name: Comment test results |
| 32 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 33 | + with: |
| 34 | + header: "jest-coverage-raw" |
| 35 | + recreate: true |
| 36 | + path: coverage-table.txt |
| 37 | + |
| 38 | + coverage-comment: |
| 39 | + name: 📝 PR Coverage Summary |
| 40 | + runs-on: ubuntu-latest |
| 41 | + permissions: |
| 42 | + pull-requests: write |
| 43 | + contents: read |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + - uses: actions/setup-node@v4 |
| 47 | + with: |
| 48 | + node-version: 22 |
| 49 | + cache: 'npm' |
| 50 | + - name: Install dependencies |
| 51 | + run: npm ci |
| 52 | + - name: Run coverage |
| 53 | + run: npm run test:coverage |
| 54 | + - name: Comment coverage summary |
| 55 | + uses: irongut/CodeCoverageSummary@v1.3.0 |
| 56 | + with: |
| 57 | + filename: reports/coverage/cobertura-coverage.xml |
| 58 | + badge: true |
| 59 | + format: markdown |
| 60 | + output: both |
| 61 | + indicators: true |
| 62 | + - name: Post coverage comment |
| 63 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 64 | + with: |
| 65 | + header: "jest-coverage-summary" |
| 66 | + recreate: true |
| 67 | + path: code-coverage-results.md |
| 68 | + |
| 69 | + coverage-upload-codecov: |
| 70 | + name: 📤 Upload Coverage to Codecov |
13 | 71 | runs-on: ubuntu-latest |
14 | 72 | steps: |
15 | 73 | - name: ⬇️ Checkout repository |
|
0 commit comments