{"id":29341122,"url":"https://github.com/chainsafe/github-analytics","last_synced_at":"2025-07-08T09:01:51.949Z","repository":{"id":65722781,"uuid":"596558946","full_name":"ChainSafe/github-analytics","owner":"ChainSafe","description":"Tool to collect analytics for Github issues and pull requests","archived":false,"fork":false,"pushed_at":"2023-02-16T16:46:55.000Z","size":890,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-18T13:01:55.451Z","etag":null,"topics":["analytics","codereview","community","github"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mpetrunic/merged-pr-stat","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChainSafe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2023-02-02T13:00:53.000Z","updated_at":"2025-02-03T01:56:02.000Z","dependencies_parsed_at":"2023-03-05T14:18:13.095Z","dependency_job_id":null,"html_url":"https://github.com/ChainSafe/github-analytics","commit_stats":{"total_commits":102,"total_committers":8,"mean_commits":12.75,"dds":0.3137254901960784,"last_synced_commit":"4dab89699f6679a2a0fca3cf499a57eb650307e3"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ChainSafe/github-analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fgithub-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fgithub-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fgithub-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fgithub-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChainSafe","download_url":"https://codeload.github.com/ChainSafe/github-analytics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fgithub-analytics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262010025,"owners_count":23244380,"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":["analytics","codereview","community","github"],"created_at":"2025-07-08T09:01:02.055Z","updated_at":"2025-07-08T09:01:51.943Z","avatar_url":"https://github.com/ChainSafe.png","language":"TypeScript","readme":"# Github Analytics\n\nThis is a tool to collect various Gtihub Analytics not currently tracked by GithHub.\nSome of the things you could analyze are response times (time till first comment/review) for new issues and pull requests, the time required to merge PRs, and statistics on community-opened issues and pull requests.\nIt is useful to measure the productivity and health of your team as well as community support and usage.\n\nMany thanks to `shibayu36` who created the initial implementation for pull request stats.\n\n## Installation\n\n```bash\nnpm install -g @chainsafe/github-analytics\nyarn global add @chainsafe/github-analytics\n```\n\n## Usage\n\nTo use this tool, you will need to obtain Github Personal Access Token (PAT) which you can do by following [Github's instructions](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). The minimum required permissions are: repo(repo:status, public_repo), read:org, read:discussions.\n\n### Issues stats\n\nThe following command aggregates Issues of web3.js and web3.js-chainlink-plugin which merged between `--start` and `--end`.  You can additionally filter Issues by the `--query` option.  See also \u003chttps://docs.github.com/en/github/searching-for-information-on-github/searching-issues-and-pull-requests\u003e if you want to know what you can specify for `--query`\n\n```bash\nGITHUB_TOKEN=... ga issues stat --start=\"2023-01-01T00:00:00\" --end=\"2023-02-01\" --query=\"repo:web3/web3.js repo:chainsafe/web3.js-plugin-chainlink\" --teamMembers=avkos,jdevcs,luu-alex,mconnelly8,Muhammad-Altabba,nikoulai,spacesailor24 --human\n```\n\noutput is\n\n```json\n{\n \"issues\": {\n    \"issueCount\": \"30 issues\",\n    \"externalIssueCount\": \"11 issues\",\n    \"externalIssueClosedCount\": \"4 issues\",\n    \"responseTimeAverage\": \"2 weeks, 17 hours, 54 minutes, 51.9395454545021 seconds\", //only external issues\n    \"responseTimeMedian\": \"6 days, 8 hours, 33 minutes, 1 second\", //only external issues\n    \"timeToCloseAverage\": \"1 week, 4 days, 4 hours, 28 minutes, 55.75 seconds\", //only external issues\n    \"timeToCloseMedian\": \"1 week, 2 days, 22 hours, 45 minutes, 30.5 seconds\" //only external issues\n  }\n}\n```\n\n* response time: diff between an Issue created and the first comment by a team member\n* timeToClose: diff between an Issue created and an Issue closed\n\n#### log command\n\nIf you want to get raw information about PullRequests, you can use a `pr log` command.\n\n### PullRequest stats\n\nThe following command aggregates PullRequests of web3.js and web3.js-chainlink-plugin which merged between `--start` and `--end`.  You can additionally filter PullRequests by the `--query` option.  See also \u003chttps://docs.github.com/en/github/searching-for-information-on-github/searching-issues-and-pull-requests\u003e if you want to know what you can specify for `--query`\n\n```bash\nGITHUB_TOKEN=... ga pr stat --start=\"2023-01-01T00:00:00\" --end=\"2023-02-01\" --query=\"repo:web3/web3.js repo:chainsafe/web3.js-plugin-chainlink\" --teamMembers=avkos,jdevcs,luu-alex,mconnelly8,Muhammad-Altabba,nikoulai,spacesailor24 --human\n```\n\noutput is\n\n```json\n{\n  \"pull_request\": {\n    \"pullRequestCount\": \"34 pull requests\",\n    \"externalPullRequestCount\": \"6 pull requests\",\n    \"additionsAverage\": \"618 lines\",\n    \"additionsMedian\": \"115 lines\",\n    \"deletionsAverage\": \"1328 lines\",\n    \"deletionsMedian\": \"25 lines\",\n    \"leadTimeAverage\": \"5 days, 13 hours, 16 minutes, 12 seconds\",\n    \"leadTimeMedian\": \"3 days, 5 hours, 50 minutes, 15 seconds\",\n    \"timeToMergeAverage\": \"4 days, 22 hours, 51 minutes, 14 seconds\",\n    \"timeToMergeMedian\": \"2 days, 7 hours, 17 minutes, 5 seconds\",\n    \"timeToMergeFromFirstReviewAverage\": \"3 days, 4 hours, 58 minutes, 49 seconds\",\n    \"timeToMergeFromFirstReviewMedian\": \"1 day, 7 hours, 14 minutes, 14 seconds\",\n    \"responseTimeAverage\": \"2 days, 12 hours, 55 minutes, 59 seconds\"\n  }\n}\n```\n\n* leadTime: diff between a first commit and a PullRequest merged date\n* timeToMerge: diff between a PullRequest created and a PullRequest merged\n* timeToMergeFromFirstReview: diff between a first review and a PullRequest merged.\n\nIf you want to know about leadTime and timeToMerge for details, See \u003chttps://sourcelevel.io/blog/5-metrics-engineering-managers-can-extract-from-pull-requests\u003e\n\n```bash\n|------------- lead time ---------------------------------|\n                |--- response time ---|\n                |---------- time to merge ----------------|\n-----------------------------------------------------------\n^               ^                     ^                   ^\nfirst commit    create PullRequest    first review        PullRequest merged\n```\n\n#### log command\n\nIf you want to get raw information about PullRequests, you can use `ga pr log` command.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainsafe%2Fgithub-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchainsafe%2Fgithub-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainsafe%2Fgithub-analytics/lists"}