{"id":15105198,"url":"https://github.com/greatwizard/coverage-diff-action","last_synced_at":"2026-03-05T08:04:57.708Z","repository":{"id":39582100,"uuid":"455141541","full_name":"GreatWizard/coverage-diff-action","owner":"GreatWizard","description":"Publish diff coverage report as PR comment, and create a coverage badge to display on the readme.","archived":false,"fork":false,"pushed_at":"2024-02-17T13:39:14.000Z","size":296,"stargazers_count":9,"open_issues_count":6,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T16:41:04.322Z","etag":null,"topics":["angular","angularjs","badge","coverage","diff","ember","emberjs","github-action","istanbul","jest","json-summary","react","reactjs","vue","vuejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/GreatWizard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2022-02-03T11:38:01.000Z","updated_at":"2024-10-21T21:10:54.000Z","dependencies_parsed_at":"2024-09-20T12:01:56.873Z","dependency_job_id":"c726d806-e694-4d0b-bfcd-716e35070616","html_url":"https://github.com/GreatWizard/coverage-diff-action","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"dfefb6335458e4936d7a688a51ff7d34bf7b97e4"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fcoverage-diff-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fcoverage-diff-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fcoverage-diff-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fcoverage-diff-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GreatWizard","download_url":"https://codeload.github.com/GreatWizard/coverage-diff-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237754152,"owners_count":19360654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["angular","angularjs","badge","coverage","diff","ember","emberjs","github-action","istanbul","jest","json-summary","react","reactjs","vue","vuejs"],"created_at":"2024-09-25T20:21:48.777Z","updated_at":"2025-10-23T00:30:50.600Z","avatar_url":"https://github.com/GreatWizard.png","language":"JavaScript","readme":"# GitHub Action: Coverage Diff\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Liberapay](https://img.shields.io/liberapay/patrons/GreatWizard.svg?logo=liberapay)](https://liberapay.com/GreatWizard/)\n\n## Presentation\n\nPublish diff coverage report as PR comment, and create a coverage badge to display on the readme.\n\n![Comment screenshot](https://raw.githubusercontent.com/GreatWizard/coverage-diff-action/master/comment.png)\n\nThis action operates on a json-summary report file as generated by most coverage tools.\n\nIt has two main modes of operation:\n\n### PR mode\n\nIf acting on a PR, it will analyze the json-summary report file (`coverage/coverage-summary.json`), and produce a diff coverage report with the json-summary file from repository's default branch.\nThen it will publish the diff coverage report as comment to the PR.\nIf a comment had already previously be written, it will be updated.\nThe comment contains information on the evolution of coverage rate attributed to this PR, as well as the rate of coverage for lines that this PR introduces.\n\n### Default branch mode\n\nIf acting on the repository's default branch (by convention `master` or `main`), it will extract the global threshold and create a small Badge JSON file.\nThe json-summary report file and the Badge JSON file will be stored on the repository's wiki.\nThis file will then have a stable URL, which means you can create a [shields.io](https://shields.io/endpoint) badge from it.\n\n## Usage\n\n### Setup\n\nPlease ensure that the **repository wiki has been initialized** with at least a single page created.\nOnce it's done, you can disable the wiki for the repository.\n\n### Minimal usage\n\n```yaml\nname: Coverage Diff\n\non:\n  push:\n    branches:\n      - master\n      - main\n  pull_request: {}\n\njobs:\n  test:\n    name: Coverage Diff\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-node@v2\n        with:\n          node-version: 16\n          cache: npm\n      - run: npm install\n      - run: npm run test\n      - name: Coverage Diff\n        uses: greatwizard/coverage-diff-action@v1\n        with:\n          github-token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Maximal usage\n\n```yaml\nname: Coverage Diff\n\non:\n  push:\n    branches:\n      - master\n      - main\n  pull_request: {}\n\njobs:\n  test:\n    name: Coverage Diff\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-node@v2\n        with:\n          node-version: 16\n          cache: npm\n      - run: npm install\n      - run: npm run test\n      - name: Coverage Diff\n        uses: greatwizard/coverage-diff-action@v1\n        with:\n          github-token: ${{ secrets.GITHUB_TOKEN }}\n\n          # Path of the json-summary file to analyze.\n          coverage-filename: coverage/coverage-summary.json\n\n          # Name of the json file containing the repository's default branch json-summary stored in the repo wiki.\n          base-summary-filename: base-summary.json\n\n          # If true, it will not fail even if the current branch's coverage is lower than the default branch's coverage.\n          allowed-to-fail: false\n\n          # Whether or not a badge will be generated and stored.\n          badge-enabled: true\n\n          # Name of the json file containing badge informations stored in the repo wiki.\n          badge-filename: coverage-diff-badge.json\n\n          # If the coverage percentage is above or equal to this value, the badge will be green.\n          badge-threshold-green: 100\n\n          # If the coverage percentage is not green and above or equal to this value, the badge will be orange. Otherwise it will be red.\n          badge-threshold-orange: 70\n```\n\n### Pinning\n\nOn the examples above, the version was set to `v1` (a branch).\nYou can also pin a specific version such as `v1.0.0` (a tag).\n\n### What about external pull requests\n\nCurrently this action fails for external pull requests.\nThe problem is described [here](https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/)\nand [here](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).\n\n### Note on the state of this action\n\nThere is no automated test so it's possible that it fails at some point if a dependency breaks compatibility.\nIf this happens, we'll fix it and put better checks in place.\n\nIt's probably usable as-is, but you're welcome to offer feedback and, if you want, contributions.\n\n## Integration in major frameworks\n\n`coverage-diff-action` operates on a report file. This report file is supposed to have been generated by a coverage tool launched in the Github workflow. In other words, using `coverage-diff-action` implies that you already have a functional coverage generation present in your workflow.\n\nIf you don't have this yet, this section will provide you some guidance depending on the framework you use.\n\nSet up code coverage with:\n- [Ember](/docs/ember.md)\n\n## Contributing\n\nIf you want to help, please get in touch (open an issue or something).\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n\n","funding_links":["https://liberapay.com/GreatWizard/"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreatwizard%2Fcoverage-diff-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreatwizard%2Fcoverage-diff-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreatwizard%2Fcoverage-diff-action/lists"}