{"id":23957788,"url":"https://github.com/fgrosse/go-coverage-report","last_synced_at":"2026-01-18T02:38:42.180Z","repository":{"id":227086782,"uuid":"770420968","full_name":"fgrosse/go-coverage-report","owner":"fgrosse","description":"A CLI tool and GitHub Action to post Go code coverage reports as comment to your pull requests.","archived":false,"fork":false,"pushed_at":"2025-09-19T17:56:51.000Z","size":941,"stargazers_count":105,"open_issues_count":14,"forks_count":31,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-20T08:42:02.214Z","etag":null,"topics":["actions","code-coverage","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fgrosse.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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-03-11T14:21:15.000Z","updated_at":"2025-10-06T17:30:46.000Z","dependencies_parsed_at":"2024-04-26T11:31:20.213Z","dependency_job_id":"17ca2188-a243-4afd-b252-109ac2cfff4e","html_url":"https://github.com/fgrosse/go-coverage-report","commit_stats":null,"previous_names":["fgrosse/go-coverage-report"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/fgrosse/go-coverage-report","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fgo-coverage-report","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fgo-coverage-report/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fgo-coverage-report/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fgo-coverage-report/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fgrosse","download_url":"https://codeload.github.com/fgrosse/go-coverage-report/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fgo-coverage-report/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28526583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["actions","code-coverage","golang"],"created_at":"2025-01-06T17:01:29.069Z","updated_at":"2026-01-18T02:38:42.118Z","avatar_url":"https://github.com/fgrosse.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eGo Coverage Report\u003c/h1\u003e\n\u003cp align=\"center\"\u003eA CLI tool and GitHub Action to post Go code coverage reports as comment to your pull requests.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/fgrosse/go-coverage-report/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/tag/fgrosse/go-coverage-report.svg?label=version\u0026color=brightgreen\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/fgrosse/go-coverage-report/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/fgrosse/go-coverage-report/actions/workflows/ci.yml/badge.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/fgrosse/go-coverage-report/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-BSD--3--Clause-blue.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n--- \n\n`go-coverage-report` is a **command line tool** and a **GitHub Action** that\nparses code coverage results to create a tabular code coverage report. This\nmarkdown report is intended as pull request comment both to highlight the\nimpact of the changes on the code coverage on all updated packages and to \nmotivate the contributors to write tests for their code.\n\nThe provided tool and GitHub Action work without any third-party services\nwhich makes them fast, secure and very easy-to-setup in your own CI/CD pipeline.\n\n## Example\n\nExample of a pull request comment created by `go-coverage-report`:\n\n![Example of a pull request comment created by go-coverage-report](screenshot.png)\n\nPlease note that by default, the \"Coverage by file\" section is collapsed so the focus\nis more on the overall impact on the coverage _per package_.\n\nThere is no indicator of the _total_ coverage of the project because the impact by\nchanged package is typically a better indicator of the quality of the changes.\nAdditionally, looking at coverage changes by package is more motivating as code coverage improvements are more pronounced (i.e. typically larger percentage values) when zooming\ninto the package level, instead of comparing changes on the project level.\n\nThe last column is an emoji \"score\" that is based on the coverage change of the package.\nThe following emojis are used:\n\n* :star2: - The coverage of the package increased by \u003e 20%\n* :tada: - The coverage of the package increased by \u003c= 20%\n* :thumbsup: - The coverage of the package increased by \u003c= 10%\n* :thumbsdown: - The coverage of the package decreased by \u003c= 10%\n* :skull: - The coverage of the package decreased by \u003e 10%, every 10% add another skull (up to five skulls)\n\n## Usage\n\nThe `go-coverage-report` tool ships with a **GitHub Action** that you can easily\ninclude in your own Workflows:\n\n```yaml\nname: CI\n\n# This setup assumes that you run the unit tests with code coverage in the same\n# workflow that will also print the coverage report as comment to the pull request. \n# Therefore, you need to trigger this workflow when a pull request is (re)opened or\n# when new code is pushed to the branch of the pull request. In addition, you also\n# need to trigger this workflow when new code is pushed to the main branch because \n# we need to upload the code coverage results as artifact for the main branch as\n# well since it will be the baseline code coverage.\n# \n# We do not want to trigger the workflow for pushes to *any* branch because this\n# would trigger our jobs twice on pull requests (once from \"push\" event and once\n# from \"pull_request-\u003esynchronize\")\non:\n  pull_request:\n    types: [opened, reopened, synchronize]\n  push:\n    branches:\n      - 'main'\n\njobs:\n  unit_tests:\n    name: \"Unit tests\"\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v4\n\n      - name: Setup Go\n        uses: actions/setup-go@v4\n        with:\n          go-version: ^1.22\n\n      # When you execute your unit tests, make sure to use the \"-coverprofile\" flag to write a \n      # coverage profile to a file. You will need the name of the file (e.g. \"coverage.txt\")\n      # in the next step as well as the next job.\n      - name: Test\n        run: go test -cover -coverprofile=coverage.txt ./...\n\n      - name: Archive code coverage results\n        uses: actions/upload-artifact@v4\n        with:\n          name: code-coverage\n          path: coverage.txt # Make sure to use the same file name you chose for the \"-coverprofile\" in the \"Test\" step\n\n  code_coverage:\n    name: \"Code coverage report\"\n    if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch\n    runs-on: ubuntu-latest\n    needs: unit_tests # Depends on the artifact uploaded by the \"unit_tests\" job\n    permissions:\n      contents:      read\n      actions:       read  # to download code coverage results from \"test\" job\n      pull-requests: write # write permission needed to comment on PR\n    steps:\n      - uses: fgrosse/go-coverage-report@v1.1.1 # Consider using a Git revision for maximum security\n        with:\n          coverage-artifact-name: \"code-coverage\" # can be omitted if you used this default value\n          coverage-file-name: \"coverage.txt\" # can be omitted if you used this default value\n```\n\n\n### Inputs\n\n\u003c!-- Could use embedmd like this: [embedmd]:# (action.yml yaml /inputs:/ /# end of inputs/) --\u003e\n```yaml\ninputs:\n  version:\n    description: 'The exact version tag of the go-coverage-report tool to use.'\n    required: true\n    default: \"v1.2.0\"\n\n  sha256sum:\n    description: 'Optional SHA256 checksum of the tarball when downloading the go-coverage-report binary.'\n    required: false\n\n  coverage-artifact-name:\n    description: 'The name of the artifact containing the code coverage results.'\n    required: true\n    default: \"code-coverage\"\n\n  coverage-file-name:\n    description: 'The name of the file containing the code coverage results.'\n    required: true\n    default: \"coverage.txt\"\n\n  root-package:\n    description: |\n      The Go import path of the tested repository to add as a prefix to all paths of the\n      changed files. This is useful to map the changed files (e.g., [\"foo/my_file.go\"]\n      to their coverage profile which uses the full package name to identify the files\n      (e.g., \"github.com/fgrosse/example/foo/my_file.go\"). Note that currently, \n      packages with a different name than their directory are not supported.\n    required: false\n    default: \"github.com/${{ github.repository }}\"\n\n  skip-comment:\n    description: |\n      Skip creating or updating the pull request comment. This may be useful when you want\n      to generate the coverage report and modify it in your own scripts.\n    required: false\n    default: 'false'\n\n  trim:\n    description: Trim a prefix in the \"Impacted Packages\" column of the markdown report.\n    required: false\n\n  github-baseline-workflow-ref:\n    description: |\n      The ref of the GitHub actions Workflow that produces the baseline coverage.\n      By default, the GitHub Actions Workflow ref is used\n      (e.g. \"octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch\").\n      You can aso just pass the name of the Workflow file directly (e.g. \"my-workflow.yml\").\n    default: ${{ github.workflow_ref }}\n    required: false\n```\n\n### Outputs\n\nThis action provides the following outputs:\n\n- `coverage_report`: The generated coverage report in Markdown format.\n\n## Limitations\n\n- Currently, code coverage profiles are uploaded as GitHub artifacts which automatically expire after 90 days.\n  In a repository which receives changes only infrequently, this might lead to issues when trying to compare\n  the code coverage of a pull request with the code coverage of the main branch (see fgrosse/go-coverage-report#5).  \n- Support **for forks** is limited since the necessary `GITHUB_TOKEN` permissions don't allow to post comments to the\n  pull request of the base repository (see fgrosse/go-coverage-report#15). If forks are important for you, this action\n  might not be the best solution.\n- Packages with a name that differs from their directory on disk are not supported yet.\n- Requires `actions/upload-artifact` \u003e= **v4** (see this [issue][upload-artifacts-issues]).\n\n## Built With\n\n* [tj-actions/changed-files](https://github.com/tj-actions/changed-files) - A GitHub Action to get the list of changed files in pull requests\n* [pkg/errors](https://github.com/pkg/errors) - Simple error handling primitives\n* [testify](https://github.com/stretchr/testify) - A simple unit test library\n* _[and more][built-with]_\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of\nconduct and on the process for submitting pull requests to this repository.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning.\nAll significant (e.g. breaking) changes are documented in the [CHANGELOG.md](CHANGELOG.md).\nA list of all available versions can be found at the [releases page][releases].\n\n## Authors\n\n- **Friedrich Große** - *Initial work* - [fgrosse](https://github.com/fgrosse)\n\n- See also the list of [contributors][contributors] who participated in this project.\n\n## License\n\nThis project is licensed under the BSD-3-Clause License - see the [LICENSE](LICENSE) file for details.\n\n[releases]: https://github.com/fgrosse/go-coverage-report/release\n[contributors]: https://github.com/fgrosse/go-coverage-report/contributors\n[built-with]: go.mod\n[upload-artifacts-issues]: https://github.com/cli/cli/issues/5625#issuecomment-1857787634\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgrosse%2Fgo-coverage-report","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgrosse%2Fgo-coverage-report","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgrosse%2Fgo-coverage-report/lists"}