Comments a PR with the coverage (jest)
Required The github token to comment in the PR.
Optional The command used to generate the coverage. Default: npx jest --coverage
Optional Add parameter to show the coverage only for the changed files. Default: true
Optional The command used to generate the coverage. Default: ''
Optional Delete previous comments before adding a new one. Default: true
Optional If already exists a coverage report the action uses it and doesn't run tests again. Default: false
Optional If define, enables sending mesaures feature to the defined host. Host URL is expected to retreive and send coverage measure via GET and POST.
GET expects: { date: Date, coverageMeasure: { percentage: number } }. Query param repository, indicating the repository name, is included in the URL.
POST will include in the body: { repository: string, coveragePercentage: number }
Optional Header field for sending the auth-token to identify against the measures server. Default: bearer
Optional Key to identify against the measures server. Shall be set as the value for the parameter defined in measures-server-auth-header-parameter
Optional Value to be set in origin header field in case the measures server has CORS enabled. If not the case, nothing needs to be set
Optional Repository name to identify in the measures server. Example: backend, web, front, app, ...'
Optional Identifies the branch from whom the measures are sent to the host. This will be the branch against the others will compare. Default: main
uses: raulanatol/jest-coverage-comment-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
.github/workflows/main.yml
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Hello world action step
id: hello
uses: raulanatol/jest-coverage-comment-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
jest-command: 'npm run jest-ci'
working-directory: 'packages/my-package'
.github/workflows/main.yml
name: Build
on: [pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Coverage
uses: raulanatol/jest-coverage-comment-action@main
with:
jest-command: yarn test-ci
use-existing-reports: true
github-token: ${{ secrets.GITHUB_TOKEN }}
measures-server-host: 'https://49f0-81-61-118-50.eu.ngrok.io/v1/testing/report/measures'
measures-server-auth-header-parameter: 'bearer'
measures-server-auth-token: 'tokenDePrueba'
measures-server-cors-origin: 'ttps://49f0-81-61-118-50.eu.ngrok.io'
measures-server-repository: 'web'
measures-server-main-branch: 'main'
To close a release you only need to execute the makefile with release_{major|minor|patch}
Example:
make release_minor