{"id":18017168,"url":"https://github.com/ncruces/go-coverage-report","last_synced_at":"2025-04-10T23:52:00.031Z","repository":{"id":77069389,"uuid":"594055717","full_name":"ncruces/go-coverage-report","owner":"ncruces","description":"GitHub Action to add a coverage badge to your Go repo","archived":false,"fork":false,"pushed_at":"2024-07-20T10:25:15.000Z","size":30,"stargazers_count":80,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T23:51:53.024Z","etag":null,"topics":["coverage","github-actions","go","golang"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/go-coverage-report","language":"Shell","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/ncruces.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}},"created_at":"2023-01-27T13:53:19.000Z","updated_at":"2025-03-19T18:47:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9c45b54-b94e-4bbc-8d3d-008aa94853ca","html_url":"https://github.com/ncruces/go-coverage-report","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncruces%2Fgo-coverage-report","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncruces%2Fgo-coverage-report/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncruces%2Fgo-coverage-report/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncruces%2Fgo-coverage-report/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ncruces","download_url":"https://codeload.github.com/ncruces/go-coverage-report/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317706,"owners_count":21083528,"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","go","golang"],"created_at":"2024-10-30T04:21:32.264Z","updated_at":"2025-04-10T23:52:00.012Z","avatar_url":"https://github.com/ncruces.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go coverage report\n\nA GitHub Action to add a coverage [report][1], [badge][2], and [chart][4] to your Go repo.\n\nApply it to your repo by adding this step to one of your workflows:\n\n```yaml\n- name: Update coverage report\n  uses: ncruces/go-coverage-report@v0\n```\n\nYour repo needs to have a Wiki for the action to work,\nand workflows need to have read _and_ write permissions to the repo.\n\nThe action has 8 configuration knobs:\n- `coverage-file`: optional coverage input file;\n  default is to generate coverage for all packages in the current module.\n- `output-dir`: optional output directory for the for the badge, report, chart;\n  default is to generate files to the root of wiki.\n- `badge-style`: optional coverage badge style,\n  generated by [shields.io](https://shields.io);\n  one of: `flat` (default), `flat-square`, `plastic`, `for-the-badge`, `social`.\n- `badge-title`: optional coverage badge title;\n  default is “coverage.”\n- `report`: default `true`,\n  generate an [HTML coverage report][1].\n- `chart`: default `false`,\n  generate an [SVG coverage chart][4].\n- `amend`: default `false`,\n  amend your Wiki, avoiding a series of “Update coverage” commits.\n\nAlso, consider:\n- running this step _after_ your tests run\n  - coverage will fail if any test fails, so you may skip it if they fail\n- running it only once per commit\n  - use a condition to avoid repeated matrix runs\n- skipping it for PRs\n  - PRs lack permission to update the Wiki,\n    nor would you want unsubmitted PRs to do so\n- allowing it to fail without failing the entire job\n  - if tests pass, the problem might be with the action itself, not your code\n\nComplete example:\n\n```yaml\n- name: Test\n  run: go test -v ./...\n\n- name: Update coverage report\n  uses: ncruces/go-coverage-report@v0\n  with:\n    report: true\n    chart: true\n    amend: true\n  if: |\n    matrix.os == 'ubuntu-latest' \u0026\u0026\n    github.event_name == 'push'  \n  continue-on-error: true\n```\n\nThe action generates an [HTML report][1], [SVG badge][2] and [chart][4],\nand saves them as “hidden” files in your Wiki.\n\n\u003e [!NOTE]  \n\u003e The [HTML coverage report][1] can't be rendered for private repositories.\n\nTo add a coverage badge to your `README.md`, use this Markdown snippet:\n\n```markdown\n[![Go Coverage](https://github.com/USER/REPO/wiki/coverage.svg)](https://raw.githack.com/wiki/USER/REPO/coverage.html)\n```\n\nClicking on the badge opens the [coverage report][1].\nIf you also want to show the [coverage chart][4],\ncreate a [Wiki page][5] and link to it instead.\n\nThe action will also [log][3] to the Wiki the unix timestamp and coverage of every run,\nso it can generate the [coverage chart][4].\n\n[1]: https://raw.githack.com/wiki/ncruces/go-sqlite3/coverage.html\n[2]: https://github.com/ncruces/go-sqlite3/wiki/coverage.svg\n[3]: https://github.com/ncruces/go-sqlite3/wiki/coverage.log\n[4]: https://github.com/ncruces/go-sqlite3/wiki/coverage-chart.svg\n[5]: https://github.com/ncruces/go-sqlite3/wiki/Test-coverage-report\n\n## Credits\n\n- [@vieux](https://github.com/vieux/) for [gocover.io](https://github.com/vieux/gocover.io) which I've used for years before creating this\n- [@Prounckk](https://github.com/Prounckk) for the [blog](https://eremeev.ca/posts/golang-test-coverage-github-action/) that prompted this solution\n- [raw.githack.com](https://raw.githack.com/) for proxying the HTML report\n- [shields.io](https://shields.io/) for SVG badges\n- [quickchart.io](https://quickchart.io/) for SVG charts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncruces%2Fgo-coverage-report","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fncruces%2Fgo-coverage-report","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncruces%2Fgo-coverage-report/lists"}