{"id":18733526,"url":"https://github.com/insightsengineering/coverage-action","last_synced_at":"2025-04-12T18:31:44.109Z","repository":{"id":45070671,"uuid":"439490077","full_name":"insightsengineering/coverage-action","owner":"insightsengineering","description":"Github Action that generates a coverage summary using a Cobertura XML report","archived":false,"fork":false,"pushed_at":"2024-07-18T11:54:05.000Z","size":214,"stargazers_count":19,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-08T16:54:43.259Z","etag":null,"topics":["coverage","github-actions"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/code-coverage-report-action","language":null,"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/insightsengineering.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"custom":["https://pharmaverse.org"]}},"created_at":"2021-12-18T00:05:27.000Z","updated_at":"2025-02-28T14:10:22.000Z","dependencies_parsed_at":"2023-11-07T13:37:27.163Z","dependency_job_id":"57ea3efb-081f-44ff-a0f2-f8335315d29a","html_url":"https://github.com/insightsengineering/coverage-action","commit_stats":{"total_commits":25,"total_committers":4,"mean_commits":6.25,"dds":0.56,"last_synced_commit":"c824e09077870548f99c15ecade2b5502344106d"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Fcoverage-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Fcoverage-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Fcoverage-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Fcoverage-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insightsengineering","download_url":"https://codeload.github.com/insightsengineering/coverage-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248613522,"owners_count":21133527,"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":["coverage","github-actions"],"created_at":"2024-11-07T15:10:07.473Z","updated_at":"2025-04-12T18:31:43.793Z","avatar_url":"https://github.com/insightsengineering.png","language":null,"funding_links":["https://pharmaverse.org"],"categories":[],"sub_categories":[],"readme":"[![SuperLinter](https://github.com/insightsengineering/coverage-action/actions/workflows/lint.yaml/badge.svg)](https://github.com/insightsengineering/coverage-action/actions/workflows/lint.yaml)\n[![Test](https://github.com/insightsengineering/coverage-action/actions/workflows/test.yaml/badge.svg)](https://github.com/insightsengineering/coverage-action/actions/workflows/test.yaml)\n\n\u003c!-- BEGIN_ACTION_DOC --\u003e\n# Code Coverage Report Action\n\n### Description\nAction that converts a Cobertura XML report into a markdown report.\n### Action Type\nComposite\n\n### Author\nInisghts Engineering\n\n### Inputs\n* `token`:\n\n  _Description_: Github token to use to publish the check.\n\n  _Required_: `false`\n\n  _Default_: `${{ github.token }}`\n\n* `path`:\n\n  _Description_: Path to the Cobertura coverage XML report.\n\n  _Required_: `false`\n\n  _Default_: `coverage.xml`\n\n* `threshold`:\n\n  _Description_: The minimum allowed coverage percentage, as a real number.\n\n  _Required_: `false`\n\n  _Default_: `0`\n\n* `fail`:\n\n  _Description_: Fail the action when the minimum coverage was not met.\n\n  _Required_: `false`\n\n  _Default_: `True`\n\n* `publish`:\n\n  _Description_: Publish the coverage report as an issue comment.\n\n  _Required_: `false`\n\n  _Default_: `False`\n\n* `diff`:\n\n  _Description_: Create a diff of the coverage report.\n\n  _Required_: `false`\n\n  _Default_: `False`\n\n* `diff-branch`:\n\n  _Description_: Branch to diff against.\n\n  _Required_: `false`\n\n  _Default_: `main`\n\n* `storage-subdirectory`:\n\n  _Description_: Subdirectory in the diff-storage branch where the XML reports will be stored.\n\n  _Required_: `false`\n\n  _Default_: `.`\n\n* `diff-storage`:\n\n  _Description_: Branch where coverage reports are stored for diff purposes.\n\n  _Required_: `false`\n\n  _Default_: `_xml_coverage_reports`\n\n* `coverage-summary-title`:\n\n  _Description_: Title for the code coverage summary in the Pull Request comment.\n\n  _Required_: `false`\n\n  _Default_: `Code Coverage Summary`\n\n* `coverage-reduction-failure`:\n\n  _Description_: Fail the action if code coverage decreased compared to the `diff-branch` is decreased.\n\n  _Required_: `false`\n\n  _Default_: `False`\n\n* `new-uncovered-statements-failure`:\n\n  _Description_: Fail the action if any new uncovered statements are introduced compared to the `diff-branch`.\n\n  _Required_: `false`\n\n  _Default_: `False`\n\n* `pycobertura-exception-failure`:\n\n  _Description_: Fail the action in case of a `Pycobertura` exception.\n\n  _Required_: `false`\n\n  _Default_: `True`\n\n* `togglable-report`:\n\n  _Description_: Make the code coverage report togglable.\n\n  _Required_: `false`\n\n  _Default_: `False`\n\n* `exclude-detailed-coverage`:\n\n  _Description_: Whether a detailed coverage report should be excluded from the PR comment.\nThe detailed coverage report contains the following information per file:\nnumber of code statements, number of statements not covered by any test,\ncoverage percentage, and line numbers not covered by any test.\n\n\n  _Required_: `false`\n\n  _Default_: `False`\n\n### Outputs\n\n* `summary`:\n\n  _Description_: A summary of coverage report\n\u003c!-- END_ACTION_DOC --\u003e\n\n## How it works\n\nThis tool makes use of the [PyCobertura](https://github.com/aconrad/pycobertura) CLI tool to produce the summary outputs. The action also supports `diff`s against a given branch and makes use of a remote branch to store reports, which can be specified via this action.\n\n## Usage\n\nExample usage:\n\n```yaml\n---\nname: Code Coverage\n\non:\n  # NOTE: Both, the 'pull_request' and the 'push'\n  # events are REQUIRED to take full advantage\n  # of the features of this action.\n  pull_request:\n    branches:\n      - main\n  push:\n    branches:\n      - main\n\njobs:\n  coverage:\n    name: Calculate code coverage\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checkout Code\n        uses: actions/checkout@v3\n\n      - name: Your logic to generate the Cobertura XML goes here\n        run: echo \"Your logic to generate the Cobertura XML goes here\"\n\n      - name: Produce the coverage report\n        uses: insightsengineering/coverage-action@v2\n        with:\n          # Path to the Cobertura XML report.\n          path: ./cobertura.xml\n          # Minimum total coverage, if you want to the\n          # workflow to enforce it as a standard.\n          # This has no effect if the `fail` arg is set to `false`.\n          threshold: 80.123\n          # Fail the workflow if the minimum code coverage\n          # reuqirements are not satisfied.\n          fail: true\n          # Publish the rendered output as a PR comment\n          publish: true\n          # Create a coverage diff report.\n          diff: true\n          # Branch to diff against.\n          # Compare the current coverage to the coverage\n          # determined on this branch.\n          diff-branch: main\n          # This is where the coverage reports for the\n          # `diff-branch` are stored.\n          # Branch is created if it doesn't already exist'.\n          diff-storage: _xml_coverage_reports\n          # A custom title that can be added to the code\n          # coverage summary in the PR comment.\n          coverage-summary-title: \"Code Coverage Summary\"\n```\n\nAn example of the output of the action can be seen below:\n\n![Action output](example.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsightsengineering%2Fcoverage-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsightsengineering%2Fcoverage-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsightsengineering%2Fcoverage-action/lists"}