{"id":15648783,"url":"https://github.com/mdelapenya/github-metrics","last_synced_at":"2026-05-17T17:08:22.715Z","repository":{"id":62102580,"uuid":"550915557","full_name":"mdelapenya/github-metrics","owner":"mdelapenya","description":"Calculate metrics of interest on Github","archived":false,"fork":false,"pushed_at":"2022-11-03T15:22:17.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-03T08:19:58.082Z","etag":null,"topics":["github","golang","metrics"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdelapenya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-13T14:31:54.000Z","updated_at":"2022-10-17T11:28:06.000Z","dependencies_parsed_at":"2022-10-26T12:00:39.630Z","dependency_job_id":null,"html_url":"https://github.com/mdelapenya/github-metrics","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mdelapenya/github-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdelapenya%2Fgithub-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdelapenya%2Fgithub-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdelapenya%2Fgithub-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdelapenya%2Fgithub-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdelapenya","download_url":"https://codeload.github.com/mdelapenya/github-metrics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdelapenya%2Fgithub-metrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33147340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["github","golang","metrics"],"created_at":"2024-10-03T12:26:23.051Z","updated_at":"2026-05-17T17:08:22.698Z","avatar_url":"https://github.com/mdelapenya.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github Metrics\n\n[![build-test](https://github.com/mdelapenya/github-metrics/actions/workflows/ci.yml/badge.svg)](https://github.com/mdelapenya/github-metrics/actions/workflows/ci.yml)\n\nThis project is a PoC to explore the Github API and retrieve certain metrics from a given repository.\n\nIt will perform certain API calls using HTTP requests and backoff strategies to mitigate rate limits in the Github API.\n\nThe project is implemented as a CLI, including commands and subcommands, and flags. Please run every command with `--help` or `-h` to discover its usage.\n\n#### Common flags\n\nThe following flags apply to all commands and subcommands.\n\n| Flag | Type | Default | Required | Description |\n| ---- | ---- | ------- | -------- | ----------- |\n| --format, -F | string | `console` | No | Response format |\n| --output, -o | string | `output.txt` | No | Output file where to write the results |\n\n## Labels\n\nWe'd like to get, for each label, how many issues are labelled for the label.\n\n#### Flags\n\n| Flag | Type | Default | Required | Description |\n| ---- | ---- | ------- | -------- | ----------- |\n| --owner, -O | string | empty | Yes | Github owner (organization or user) |\n| --repository, -R | string | empty | Yes | Github repository |\n\n#### Usage\n\n```shell\nghm issues labels -O testcontainers -R testcontainers-go\n```\n\nIt will first get all the labels in the repository, and for each it will get the total number of issues, printing the result in console:\n\n```\n{\"level\":\"info\",\"ts\":1666776981.5668511,\"caller\":\"log/logger.go:38\",\"msg\":\"Processing labels\",\"count\":18}\n{\"level\":\"warn\",\"ts\":1666776981.601449,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":1,\"elapsedTime\":0.034401667,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"compose\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666776982.191045,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":2,\"elapsedTime\":0.62400025,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"compose\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666776983.668726,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":3,\"elapsedTime\":2.101689958,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"compose\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666776986.034081,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":4,\"elapsedTime\":4.467057167,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"compose\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666776989.820698,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":5,\"elapsedTime\":8.253687333,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"compose\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666776994.496547,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":6,\"elapsedTime\":12.929558833,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"compose\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777000.46876,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":7,\"elapsedTime\":18.901799292,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"compose\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"info\",\"ts\":1666777003.696355,\"caller\":\"log/logger.go:38\",\"msg\":\"compose\",\"count\":12}\n{\"level\":\"info\",\"ts\":1666777004.304099,\"caller\":\"log/logger.go:38\",\"msg\":\"dependencies\",\"count\":99}\n{\"level\":\"info\",\"ts\":1666777004.647705,\"caller\":\"log/logger.go:38\",\"msg\":\"go\",\"count\":10}\n{\"level\":\"info\",\"ts\":1666777004.954628,\"caller\":\"log/logger.go:38\",\"msg\":\"good-first-issue\",\"count\":10}\n{\"level\":\"info\",\"ts\":1666777005.331155,\"caller\":\"log/logger.go:38\",\"msg\":\"hacktoberfest\",\"count\":15}\n{\"level\":\"info\",\"ts\":1666777005.499369,\"caller\":\"log/logger.go:38\",\"msg\":\"os/mac\",\"count\":0}\n{\"level\":\"info\",\"ts\":1666777005.8398788,\"caller\":\"log/logger.go:38\",\"msg\":\"os/windows\",\"count\":2}\n{\"level\":\"info\",\"ts\":1666777006.142145,\"caller\":\"log/logger.go:38\",\"msg\":\"podman\",\"count\":7}\n{\"level\":\"info\",\"ts\":1666777006.376652,\"caller\":\"log/logger.go:38\",\"msg\":\"python\",\"count\":1}\n{\"level\":\"info\",\"ts\":1666777006.730922,\"caller\":\"log/logger.go:38\",\"msg\":\"type/bc-break\",\"count\":10}\n{\"level\":\"warn\",\"ts\":1666777006.765012,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":1,\"elapsedTime\":0.034032667,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777007.129405,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":2,\"elapsedTime\":0.398426125,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777007.7629418,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":3,\"elapsedTime\":1.031964792,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777009.401166,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":4,\"elapsedTime\":2.670194458,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777013.4986129,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":5,\"elapsedTime\":6.767663167,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777020.106155,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":6,\"elapsedTime\":13.3752205,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777023.715019,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":7,\"elapsedTime\":16.984120417,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777028.1540868,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":8,\"elapsedTime\":21.423204667,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777032.2879229,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":9,\"elapsedTime\":25.557060958,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777037.169069,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":10,\"elapsedTime\":30.4382275,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777041.1225789,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":11,\"elapsedTime\":34.391753792,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777045.123342,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":12,\"elapsedTime\":38.392541708,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777051.056513,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":13,\"elapsedTime\":44.32573925,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777054.6858501,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":14,\"elapsedTime\":47.955094583,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777058.238646,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":15,\"elapsedTime\":51.507907583,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777062.5850592,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":16,\"elapsedTime\":55.85433475,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fbug\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777062.585168,\"caller\":\"log/logger.go:42\",\"msg\":\"failed to get issues count. Will be retried later\",\"label\":\"type/bug\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"warn\",\"ts\":1666777062.619869,\"caller\":\"log/logger.go:42\",\"msg\":\"error while processing the Github search. Retrying.\",\"retryCount\":1,\"elapsedTime\":0.034648709,\"url\":\"https://api.github.com/search/issues?q=repo:testcontainers/testcontainers-go+label:\\\"type%2Fdocs\\\"\",\"error\":\"GET request failed with 403\"}\n{\"level\":\"info\",\"ts\":1666777063.912952,\"caller\":\"log/logger.go:38\",\"msg\":\"type/docs\",\"count\":36}\n{\"level\":\"info\",\"ts\":1666777064.6252182,\"caller\":\"log/logger.go:38\",\"msg\":\"type/feature\",\"count\":62}\n{\"level\":\"info\",\"ts\":1666777065.251224,\"caller\":\"log/logger.go:38\",\"msg\":\"type/housekeeping\",\"count\":46}\n{\"level\":\"info\",\"ts\":1666777065.526626,\"caller\":\"log/logger.go:38\",\"msg\":\"type/question\",\"count\":6}\n{\"level\":\"info\",\"ts\":1666777065.8371048,\"caller\":\"log/logger.go:38\",\"msg\":\"type/security\",\"count\":5}\n{\"level\":\"info\",\"ts\":1666777066.095794,\"caller\":\"log/logger.go:38\",\"msg\":\"type/test-flakiness\",\"count\":3}\n{\"level\":\"info\",\"ts\":1666777066.4683468,\"caller\":\"log/logger.go:38\",\"msg\":\"type/test-improvement\",\"count\":12}\n{\"level\":\"info\",\"ts\":1666777066.4684732,\"caller\":\"log/logger.go:38\",\"msg\":\"Retrying failed labels\",\"labels\":[\"type/bug\"]}\n{\"level\":\"info\",\"ts\":1666777067.092025,\"caller\":\"log/logger.go:38\",\"msg\":\"type/bug\",\"count\":39}\n```\n\n## Code Search\n\nWe'd like to get how many occurrences of a string are present across all Github repositories. For that we are going to perform an authenticated call to `https://cs.github.com/api/count`, which is still in _Technology Preview_ and there is no API available yet.\n\nFor that reason, we need to export the `GHM_GITHUB_COOKIE` environment variable, so that the code is able to pass it as an HTTP header to the HTTP request.\n\n\u003e To get your HTTP session cookie from Github, simply use a sniffer (i.e Chrome's network tab), go to github.com and get the session cookie from Headers section once you are logged in.\n\n#### Flags\n\n| Flag | Type | Default | Required | Description |\n| ---- | ---- | ------- | -------- | ----------- |\n| --query, -Q | string | empty | Yes | Search query |\n| --title, -T | string | Total files | No | Title to be used in the output message |\n\n#### Usage\n\nTo use this command, please define a search query using this syntax: https://cs.github.com/about/syntax \n\n```shell\nghm cs --query \"testcontainers-go v0.15.0 path:go.mod\" --title \"Testcontainers for Go\"\n```\n\nIt will print the count of the files using the application formatter (default is console log):\n\n```\n{\"level\":\"info\",\"ts\":1666777433.197243,\"caller\":\"log/logger.go:38\",\"msg\":\"Testcontainers for Go\",\"count\":66}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdelapenya%2Fgithub-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdelapenya%2Fgithub-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdelapenya%2Fgithub-metrics/lists"}