{"id":23555565,"url":"https://github.com/kostrykin/report-test-coverage-action","last_synced_at":"2026-04-15T17:32:37.580Z","repository":{"id":223864498,"uuid":"761747419","full_name":"kostrykin/report-test-coverage-action","owner":"kostrykin","description":"Create badge of the test coverage + report the test coverage in pull requests","archived":false,"fork":false,"pushed_at":"2025-12-24T16:34:53.000Z","size":70,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T06:48:38.342Z","etag":null,"topics":["ci","github-action","github-actions","github-workflows","test-coverage"],"latest_commit_sha":null,"homepage":"","language":"Python","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/kostrykin.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":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":"2024-02-22T12:17:37.000Z","updated_at":"2025-12-24T16:35:02.000Z","dependencies_parsed_at":"2024-08-02T16:27:52.998Z","dependency_job_id":"35a2a915-12a8-4119-805c-d43c9e6a5f35","html_url":"https://github.com/kostrykin/report-test-coverage-action","commit_stats":null,"previous_names":["kostrykin/report-test-coverage-action"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/kostrykin/report-test-coverage-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostrykin%2Freport-test-coverage-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostrykin%2Freport-test-coverage-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostrykin%2Freport-test-coverage-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostrykin%2Freport-test-coverage-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kostrykin","download_url":"https://codeload.github.com/kostrykin/report-test-coverage-action/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostrykin%2Freport-test-coverage-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31852819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: 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":["ci","github-action","github-actions","github-workflows","test-coverage"],"created_at":"2024-12-26T13:18:48.790Z","updated_at":"2026-04-15T17:32:37.575Z","avatar_url":"https://github.com/kostrykin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *[report-test-coverage-action](https://github.com/kostrykin/report-test-coverage-action)*\n\n[![Report test coverage example](https://github.com/kostrykin/report-test-coverage-action/actions/workflows/test.yml/badge.svg)](https://github.com/kostrykin/report-test-coverage-action/actions/workflows/test.yml)\n\nDetermines the test coverage of a Python module using [*coverage.py*](https://coverage.readthedocs.io/en/7.4.2/).\nGenerates a badge for the determined coverage when triggered by a `push` event.\nWhen triggered by a `pull_request` event, the determined coverage is added as a comment to the corresponding pull request.\n\n\u003cimg width=\"909\" height=\"282\" alt=\"Bildschirmfoto 2025-12-24 um 16 08 51\" src=\"https://github.com/user-attachments/assets/875d1eb0-ec97-474f-bb9a-b75bb4fe7849\" /\u003e\n\nExample badge generated using this action:\n\n[![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kostrykin/d152375a04f7ab9ee9b247de41245b24/raw/report-test-coverage-action.json)](https://github.com/kostrykin/report-test-coverage-action/actions/workflows/test.yml)\n\n## Installation\n\n### Create the main `test.yml` workflow\n\n1. The main workflow should be given an expressive name, such as:\n   ```yml\n   name: Report test coverage\n   ```\n2. The main workflow should be triggered by `push` and `pull_request` events. For `push` events, make sure that the workflow is only triggered on the main branch, or whichever branch you want to be associated with the value reported by the generated badge:\n   ```yml\n   on:\n     pull_request:\n     push:\n       branches: ['master']\n   ```\n3. Create a Gist which will be used to store the values for the badge. To do that, simply create an empty Gist. You will need the ID of the Gist. If `https://gist.github.com/kostrykin/d152375a04f7ab9ee9b247de41245b24` is the URL of your Gist, then `d152375a04f7ab9ee9b247de41245b24` is the ID.\n4. Create a PAT with Gist permission, and add it as your `GIST_SECRET` by going to your repository **Settings \u003e Secrets and variables \u003e Actions \u003e New repository secret**.\n5. Add the action to the workflow and replace `d152375a04f7ab9ee9b247de41245b24` by your Gist ID:\n   ```yml\n   - uses: kostrykin/report-test-coverage-action@v2.0.2\n     with:\n       gist-id: d152375a04f7ab9ee9b247de41245b24\n       gist-auth: ${{ secrets.GIST_SECRET }}\n   ```\n   When embedded into a matrix strategy (e.g., for testing multiple Python versions), the reporting should be restricted to a single step. This can be achieved, for example, by adding:\n   ```yml\n       report: ${{ strategy.job-index == 0 }}\n   ```\n   You can also specify a `working-directory` as a relative path to the root of the repository (e.g., `./example`) if your Python module and the corresponding `tests` directory are not direct descendents of the repository root.\n\nFor a full example, see the workflow file *.github/workflows/test.yml* and the *example/* directory.\n\n### Create the `post-comment.yml` workflow\n\nTo report the test coverage as comments in pull requests, a second workflow must be set up. This is because the main workflow runs in the context of the base branch of the pull request (which potentially is a fork repository that has no permissions to post comments into the pull request of the upstream repository). The `post-comment.yml` workflow should look as follows:\n```yml\nname: Post pull request comment\n\non:\n  workflow_run:\n    workflows: [Report test coverage]  # Replace this by EXACT NAME of the main workflow!\n    types: [completed]\n\njobs:\n  post_pr_comment:\n    runs-on: ubuntu-latest\n    permissions:\n      pull-requests: write\n    if: ${{ github.event.workflow_run.conclusion == 'success' }}\n    steps:\n\n      - uses: kostrykin/post-gh-comment-from-artifact-action@v1.0.2\n        with:\n          signature: '\u003c!-- report-test-coverage-action --\u003e'\n```\n\n## Examples\n\nList of further examples:\n\n- https://github.com/BMCV/giatools\n- https://github.com/BMCV/segmetrics\n- https://github.com/kosmotive/cs2pb\n- https://github.com/kostrykin/repype\n- https://github.com/kostrykin/tournaments\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostrykin%2Freport-test-coverage-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkostrykin%2Freport-test-coverage-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostrykin%2Freport-test-coverage-action/lists"}