{"id":19972611,"url":"https://github.com/jpb06/coverage-badges-action","last_synced_at":"2026-02-25T22:03:52.766Z","repository":{"id":222494759,"uuid":"665213446","full_name":"jpb06/coverage-badges-action","owner":"jpb06","description":"Github action generating coverage badges from a coverage json summary","archived":false,"fork":false,"pushed_at":"2026-02-21T00:54:59.000Z","size":17134,"stargazers_count":7,"open_issues_count":10,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-21T06:50:28.518Z","etag":null,"topics":["badges","effect-ts","github-actions","jest","test-coverage","vitest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpb06.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-11T17:35:47.000Z","updated_at":"2026-02-14T14:26:44.000Z","dependencies_parsed_at":"2024-04-22T19:40:22.427Z","dependency_job_id":"8b49c52c-a739-4692-8520-c1bc6109d0a0","html_url":"https://github.com/jpb06/coverage-badges-action","commit_stats":null,"previous_names":["jpb06/coverage-bagdes-action","jpb06/coverage-badges-action"],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/jpb06/coverage-badges-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fcoverage-badges-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fcoverage-badges-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fcoverage-badges-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fcoverage-badges-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpb06","download_url":"https://codeload.github.com/jpb06/coverage-badges-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fcoverage-badges-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29842856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T21:18:31.832Z","status":"ssl_error","status_checked_at":"2026-02-25T21:18:29.265Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["badges","effect-ts","github-actions","jest","test-coverage","vitest"],"created_at":"2024-11-13T03:08:42.802Z","updated_at":"2026-02-25T22:03:52.761Z","avatar_url":"https://github.com/jpb06.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coverage-badges-action\n\n[![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode\u0026label=\u0026message=Open%20in%20Visual%20Studio%20Code\u0026labelColor=2c2c32\u0026color=007acc\u0026logoColor=007acc)](https://open.vscode.dev/jpb06/coverage-badges-action)\n![Github workflow](https://img.shields.io/github/actions/workflow/status/jpb06/coverage-badges-action/tests-scan.yml?branch=main\u0026logo=github-actions\u0026label=last%20workflow)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jpb06_coverage-badges-action)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=jpb06_coverage-badges-action)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=jpb06_coverage-badges-action)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=jpb06_coverage-badges-action)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=jpb06_coverage-badges-action)\n![Total coverage](./badges/coverage-total.svg)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=ncloc)](https://sonarcloud.io/summary/new_code?id=jpb06_coverage-badges-action)\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=jpb06_coverage-badges-action)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=code_smells)](https://sonarcloud.io/dashboard?id=jpb06_coverage-badges-action)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=jpb06_coverage-badges-action)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=jpb06_coverage-badges-action)\n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=jpb06_coverage-badges-action\u0026metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=jpb06_coverage-badges-action)\n![Last commit](https://img.shields.io/github/last-commit/jpb06/coverage-badges-action?logo=git)\n\nGenerating coverage badges and pushing them to the repository.\n\n\u003c!-- readme-package-icons start --\u003e\n\n\u003cp align=\"left\"\u003e\u003ca href=\"https://docs.github.com/en/actions\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/GithubActions-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://www.typescriptlang.org/docs/\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/TypeScript.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://nodejs.org/en/docs/\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/NodeJS-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://bun.sh/docs\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Bun-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://biomejs.dev/guides/getting-started/\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Biome-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://github.com/conventional-changelog\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/CommitLint.Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://esbuild.github.io/getting-started/#install-esbuild\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Esbuild-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://vitest.dev/guide/\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Vitest-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://www.effect.website/docs/quickstart\" target=\"_blank\"\u003e\u003cimg height=\"50\" width=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Effect-Dark.svg\" /\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003c!-- readme-package-icons end --\u003e\n\n## ⚡ Description\n\nThis github action generates testing coverage badges from a coverage summary and pushes them to the repo at `./badges`. There is five badges generated:\n\n![Branches](./badges/coverage-branches.svg)\n![Functions](./badges/coverage-functions.svg)\n![Lines](./badges/coverage-lines.svg)\n![Statements](./badges/coverage-statements.svg)\n![Coverage total](./badges/coverage-total.svg)\n\nYou can use them on a readme like so:\n\n```markdown\n![Branches](./badges/coverage-branches.svg)\n![Functions](./badges/coverage-functions.svg)\n![Lines](./badges/coverage-lines.svg)\n![Statements](./badges/coverage-statements.svg)\n![Coverage total](./badges/coverage-total.svg)\n```\n\n## ⚡ Requirements\n\nYou will need to add json-summary to coverage reporters in your test runner config. You will also need to run your tests suite before calling this action in your ci workflow. See `usage` for an example.\n\n### 🔶 vitest\n\n`vite config`\n\n```typescript\nimport { defineConfig } from 'vitest/config';\n\nexport default defineConfig({\n  test: {\n    coverage: {\n      reporter: ['json-summary'],\n      // ...\n    },\n  },\n});\n```\n\n### 🔶 jest\n\n`jest config`\n\n```javascript\nmodule.exports = {\n   coverageReporters: [\"json-summary\"];\n   // ...\n};\n```\n\n## ⚡ Inputs\n\n### 🔶 `no-commit`\n\nIf set to `true`, badges won't be committed by the github action.\n\n\u003e Default value: **false**\n\n### 🔶 `branches`\n\nBranches on which the badges should be generated, separated by commas. Optionally, you can set the value as `*` to specify generation should always happen.\n\n\u003e Default value: **master,main**\n\n### 🔶 `target-branch`\n\nThe branch on which generated badges should be pushed. If unset, the current branch (on which the action is ran against) will be used.\n\n### 🔶 `coverage-summary-path`\n\nJest coverage summary paths (json-summary). Defining this may be useful if you need to run this action on a monorepo. Can be an array of glob paths.\n\n\u003e Default value:\n\n```yaml |\n./coverage/coverage-summary.json\n```\n\n### 🔶 `badges-icon`\n\nThe icon to use for the badges, as a simple icons slug. You can find slugs [here](https://simpleicons.org/).\n\n\u003e Default is [file-icons:test-generic](https://icon-sets.iconify.design/file-icons/test-generic/).\n\n### 🔶 `badges-labels-prefix`\n\nLabel prefix for the generated badges text. For example if you use `Repo test coverage`, generated badges will have a label matching `Repo test coverage: {key}` where `key = 'total' | 'lines' | 'statements' | 'functions' | 'branches'`.\n\n\u003e Default value: **`Test coverage: `**\n\n### 🔶 `commit-message`\n\nCommit message of the commit with generated badges.\n\n\u003e Default value: **Updating coverage badges**\n\n### 🔶 `commit-user`\n\nCustomizing the name of the user committing generated badges (optional).\n\n\u003e Default value: **\u003ccontext.actor\u003e**\n\n### 🔶 `commit-user-email`\n\nCustomizing the email of the user committing generated badges (optional).\n\n\u003e Default value: **\u003ccontext.actor\u003e@users.noreply.github.com**\n\n### 🔶 `output-folder`\n\nWhere badges should be written (optional).\n\n\u003e Default value: **./badges**\n\n## ⚡ Usage\n\nLet's first define an npm script to run jest in package.json, specifying the coverage option to generate a coverage report:\n\n```json\n{\n  \"scripts\": {\n    // in case you use jest\n    \"test-ci\": \"jest --ci --coverage\",\n    // or if you use vitest ...\n    \"test-ci\": \"vitest --coverage --run\"\n  }\n}\n```\n\nLet's then define our workflow:\n\n```yaml\nname: ⚡ My ci things\n\non: [push]\n\njobs:\n  my-workflow:\n    name: 📣 Generate cool badges\n    runs-on: ubuntu-latest\n    steps:\n\n    # Necessary to push the generated badges to the repo\n    - name: ⬇️ Checkout repo\n      uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0\n\n    # ...\n\n    # Necessary to generate the coverage report.\n    # Make sure to add 'json-summary' to the coverageReporters in jest options\n    - name: 🔍 Tests\n      run: yarn test-ci\n\n    - name: ⚙️ Generating coverage badges\n      uses: jpb06/coverage-badges-action@latest\n        with:\n          branches: master,preprod,staging\n          badges-icon: vitest\n\n```\n\nThe badges will be generated when the action runs on the master, preprod or staging branch.\n\n### 🔶 Using a custom jest coverage summary file path\n\nIn case you need to define a custom path for the coverage summary file, you can use the `coverage-summary-path` input like so:\n\n```yaml\n    [...]\n    - name: ⚙️ Generating coverage badges\n      uses: jpb06/coverage-badges-action@latest\n        with:\n          coverage-summary-path: |\n            ./my-module/coverage/coverage-summary.json\n```\n\n### 🔶 Generating badges from several subpaths for `coverage-summary-path` to generate badges from several reports (several apps in a monorepo for example):\n\nYou may use an array of wildcard glob paths when you want to generate badges for several summary reports. In the example, we will generate a set of badges for each app in our monorepo:\n\n```yaml\n    [...]\n    - name: ⚙️ Generating coverage badges\n      uses: jpb06/coverage-badges-action@latest\n        with:\n          coverage-summary-path: |\n            ./apps/**/coverage/coverage-summary.json\n            ./libs/**/coverage/coverage-summary.json\n```\n\nBadges will be written in subfolders following the captured glob path folder structure.\nSo for example if we have three apps defined as `apps/front/auth`, `apps/front/dashboard` and `apps/back`, the generated folder structure would look like:\n\n```bash\n# Coverage badges for the auth frontend app\n./badges/front/auth/*\n\n# Coverage badges for the dashboard frontend app\n./badges/front/dashboard/*\n\n# Coverage badges for the backend app\n./badges/back/*\n```\n\n### 🔶 Pushing generated badges to a custom branch\n\nYour perpetual branches should be protected to avoid some people from force pushing on them for example. Sadly there is no way to push badges to a protected branch 😿.\n\nA workaround is to push them to a custom branch. Here is an example using a `badges` branch:\n\n```yaml\nname: ⚡ Generate badges on custom branch\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  generate-badges-on-custom-branch:\n    name: 🏷️ Generate badges on the badges branch\n    runs-on: ubuntu-latest\n    steps:\n      - name: ⬇️ Checkout repo\n        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0\n\n      - name: 📦 Setup pnpm\n        uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0\n        with:\n          version: latest\n\n      - name: ⎔ Setup node\n        uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0\n        with:\n          node-version-file: '.node-version'\n          registry-url: 'https://registry.npmjs.org'\n          cache: 'pnpm'\n          cache-dependency-path: ./package.json\n\n      - name: 📥 Install deps\n        run: pnpm install --frozen-lockfile\n\n      - name: 🔴 Delete remote badges branch\n        run: git push origin --delete badges\n\n      - name: ➕ Create badges branch\n        run: git checkout -b badges\n\n      - name: 🔍 Tests\n        run: pnpm test-ci\n\n      - name: ⚙️ Generating coverage badges\n        uses: jpb06/coverage-badges-action@latest\n        with:\n          branches: '*'\n          target-branch: badges\n\n      - name: ⬆️ Push badges branch\n        run: git push origin badges\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpb06%2Fcoverage-badges-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpb06%2Fcoverage-badges-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpb06%2Fcoverage-badges-action/lists"}