{"id":17882182,"url":"https://github.com/nao1215/leadtime","last_synced_at":"2025-03-22T12:31:34.537Z","repository":{"id":74672567,"uuid":"604604521","full_name":"nao1215/leadtime","owner":"nao1215","description":"leadtime - caluculate GitHub PR lead time statistics","archived":false,"fork":false,"pushed_at":"2025-03-12T20:39:19.000Z","size":217,"stargazers_count":9,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T11:05:05.887Z","etag":null,"topics":["cli","command-line-tool","github","github-api","leadtime"],"latest_commit_sha":null,"homepage":"","language":"Go","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/nao1215.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-02-21T12:14:31.000Z","updated_at":"2025-02-14T02:23:58.000Z","dependencies_parsed_at":"2025-01-09T00:27:20.355Z","dependency_job_id":"1493a925-d218-4bf7-8505-e80a048e09da","html_url":"https://github.com/nao1215/leadtime","commit_stats":{"total_commits":66,"total_committers":2,"mean_commits":33.0,"dds":0.06060606060606055,"last_synced_commit":"b08d505284caa282008c2001da9d130f15987949"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nao1215%2Fleadtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nao1215%2Fleadtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nao1215%2Fleadtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nao1215%2Fleadtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nao1215","download_url":"https://codeload.github.com/nao1215/leadtime/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244959443,"owners_count":20538625,"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":["cli","command-line-tool","github","github-api","leadtime"],"created_at":"2024-10-28T12:48:32.525Z","updated_at":"2025-03-22T12:31:33.181Z","avatar_url":"https://github.com/nao1215.png","language":"Go","readme":"![Coverage](https://raw.githubusercontent.com/nao1215/octocovs-central-repo/main/badges/nao1215/leadtime/coverage.svg)\n![Test Execution Time](https://raw.githubusercontent.com/nao1215/octocovs-central-repo/main/badges/nao1215/leadtime/time.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nao1215/leadtime)](https://goreportcard.com/report/github.com/nao1215/leadtime)\n[![reviewdog](https://github.com/nao1215/leadtime/actions/workflows/reviewdog.yml/badge.svg)](https://github.com/nao1215/leadtime/actions/workflows/reviewdog.yml)\n[![LinuxUnitTest](https://github.com/nao1215/leadtime/actions/workflows/linux_test.yml/badge.svg)](https://github.com/nao1215/leadtime/actions/workflows/linux_test.yml)\n[![MacUnitTest](https://github.com/nao1215/leadtime/actions/workflows/mac_test.yml/badge.svg)](https://github.com/nao1215/leadtime/actions/workflows/mac_test.yml)\n[![WindowsUnitTest](https://github.com/nao1215/leadtime/actions/workflows/windows_test.yml/badge.svg)](https://github.com/nao1215/leadtime/actions/workflows/windows_test.yml)\n# leadtime - calculate GitHub PR lead time statistics\n```\n|------------- lead time -------------|\n|               |--- time to merge ---|\n---------------------------------------\n^               ^                     ^\nfirst commit    create PR          merge PR\n```\nleedtime is a command that outputs statistics about the time it takes for a GitHub Pull Request to be merged. The leadtime command was developed under the influence of the following books.\n- Eng: [Accelerate: The Science of Lean Software and DevOps: Building and Scaling High Performing Technology Organizations](https://www.amazon.com/dp/1942788339/ref=cm_sw_r_cp_ep_dp_sBN8BbGC11MBS)\n- JP: [LeanとDevOpsの科学［Accelerate］](https://www.amazon.co.jp/Lean%E3%81%A8DevOps%E3%81%AE%E7%A7%91%E5%AD%A6%EF%BC%BBAccelerate%EF%BC%BD-%E3%83%86%E3%82%AF%E3%83%8E%E3%83%AD%E3%82%B8%E3%83%BC%E3%81%AE%E6%88%A6%E7%95%A5%E7%9A%84%E6%B4%BB%E7%94%A8%E3%81%8C%E7%B5%84%E7%B9%94%E5%A4%89%E9%9D%A9%E3%82%92%E5%8A%A0%E9%80%9F%E3%81%99%E3%82%8B-impress-top-gear%E3%82%B7%E3%83%AA%E3%83%BC%E3%82%BA-ebook/dp/B07L2R3LTN)\n\nThe motivation for developing the leadtime command is to measure lead time for changes. I previously used unit test coverage as a measure of software quality. However, I felt that unless we wrote creative tests and rewrote the code, test coverage would increase but quality would not improve. \n  \nTherefore, I considered measuring lead time, one of the indicators presented in the above book.\n\n## How to install\n### Use \"go install\"\nIf you does not have the golang development environment installed on your system, please install golang from the [golang official website](https://go.dev/doc/install).\n```\n go install github.com/nao1215/leadtime@latest\n```\n\n### Use homebrew (aarch64)\n```\n$ brew tap nao1215/tap\n$ brew install nao1215/tap/leadtime\n```\n\n## How to use\n### Usage\n```\nUsage:\n  leadtime stat [flags]\n\nExamples:\n  LT_GITHUB_ACCESS_TOKEN=XXX leadtime stat --owner=nao1215 --repo=sqly\n\nFlags:\n  -a, --all                    Print all data used for statistics\n  -B, --exclude-bot            Exclude Pull Requests created by bots\n  -P, --exclude-pr ints        Exclude specified Pull Requests (e.g. '-P 1,3,19')\n  -U, --exclude-user strings   Exclude Pull Requests created by specified user (e.g. '-U nao,alice')\n  -h, --help                   help for stat\n  -j, --json                   Output json\n  -m, --markdown               Output markdown\n  -o, --owner string           Specify GitHub owner name\n  -r, --repo string            Specify GitHub repository name\n```\n\n### Execution example\nYou need to set GitHub access token in environment variable \"LT_GITHUB_ACCESS_TOKEN\". If you want to check github.com/nao1215/sqly repository, you execute bellow.\n```\n$ leadtime stat --owner=nao1215 --repo=sqly\n[statistics]\n Total PR       = 28\n Lead Time(Max) = 21144[min]\n Lead Time(Min) = 1[min]\n Lead Time(Sum) = 35310[min]\n Lead Time(Ave) = 1261.07[min]\n Lead Time(Median) = 66.50[min]\n```\n\n\n### json format output\nIf you change output format to json, you use --json option.\n```\n$ leadtime stat --owner=nao1215 --repo=sqly --json | jq .\n{\n  \"total_pr\": 28,\n  \"lead_time_maximum\": 21144,\n  \"lead_time_minimum\": 1,\n  \"lead_time_summation\": 35310,\n  \"lead_time_average\": 1261.0714285714287,\n  \"lead_time_median\": 66.5\n}\n```\n\n### markdown format output\nIf you change output format to markdown, you use --markdown option. Markdown output sample is [here](doc/sample_leadtime.md).\n```\n$ leadtime stat --owner=nao1215 --repo=gup --markdown\n```\n\nIf you use --markdown, leadtime command output lead time line graph, like this.\n![PR Lead Time](./doc/leadtime.png)\n\n### PR information used in statistics\nIf you want to check PR information used in statistics, you use --all option. The --all option is available for all output formats (json, markdown, default).\n```\n$ leadtime stat --owner=nao1215 --repo=sqly --json --all | jq .\n{\n  \"lead_time_statistics\": {\n    \"total_pr\": 28,\n    \"lead_time_maximum\": 21144,\n    \"lead_time_minimum\": 1,\n    \"lead_time_summation\": 35310,\n    \"lead_time_average\": 1261.0714285714287,\n    \"lead_time_median\": 66.5\n  },\n  \"pull_requests\": [\n    {\n      \"number\": 29,\n      \"state\": \"closed\",\n      \"title\": \"Bump github.com/fatih/color from 1.13.0 to 1.14.1\",\n      \"first_commit_at\": \"2023-01-23T20:21:58Z\",\n      \"created_at\": \"2023-02-07T12:46:37Z\",\n      \"closed_at\": \"2023-02-07T12:46:37Z\",\n      \"merged_at\": \"2023-02-07T12:46:37Z\",\n      \"user\": {\n        \"name\": \"dependabot[bot]\",\n        \"Bot\": true\n      },\n      \"merge_time_minutes\": 21144\n    },\n    {\n      \"number\": 28,\n      \"state\": \"closed\",\n      \"title\": \"Change golden pacakge import path\",\n      \"first_commit_at\": \"2022-12-03T09:48:37Z\",\n      \"created_at\": \"2022-12-03T10:01:18Z\",\n      \"closed_at\": \"2022-12-03T10:01:18Z\",\n      \"merged_at\": \"2022-12-03T10:01:18Z\",\n      \"user\": {\n        \"name\": \"nao1215\",\n        \"Bot\": false\n      },\n      \"merge_time_minutes\": 12\n    },\n    ~~\n    ~~\n```\n\n### Exclude PRs\n- --exclude-bot option: Exclude Pull Requests created by bots\n  ```\n  leadtime stat --owner=nao1215 --repo=gup --exclude-bot\n  ```\n\n- --exclude-pr option: Exclude specified Pull Requests\n  ```\n  leadtime stat --owner=nao1215 --repo=gup --exclude-pr=1,3,11\n  ```\n\n- --exclude-user option: Exclude Pull Requests created by specified user\n  ```\n  leadtime stat --owner=nao1215 --repo=gup --exclude-user=nao,mio\n  ```\n\n## Features to be added\nThe leadtime command is targeted to be combined with a GitHub action to be able to look back at statistical data on GitHub. I also plan to make it possible to output the information necessary to shorten leadtime.\n- [ ] CSV output format\n- [x] JSON output format\n- [ ] Markdown file output\n- [ ] Output to file\n- [ ] Supports GitHub Actions\n- [x] Exclude the bot's PR\n- [ ] faster by goroutine\n\n## Contributing / Contact\nFirst off, thanks for taking the time to contribute! heart Contributions are not only related to development. For example, GitHub Star motivates me to develop!\n\n[![Star History Chart](https://api.star-history.com/svg?repos=nao1215/leadtime\u0026type=Date)](https://star-history.com/#nao1215/leadtime\u0026Date)\n\n  \nIf you would like to send comments such as \"find a bug\" or \"request for additional features\" to the developer, please use one of the following contacts.\n- [GitHub Issue](https://github.com/nao1215/leadtime/issues)\n\n## Other project\n- [shibayu36/merged-pr-stat](https://github.com/shibayu36/merged-pr-stat)\n- [isanasan/dmps](https://github.com/isanasan/dmps)\n- [Trendyol/four-key](https://github.com/Trendyol/four-key)\n- [hmiyado/four-keys](https://github.com/hmiyado/four-keys)\n\n\n## LICENSE\nThe leadtime project is licensed under the terms of [MIT LICENSE](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnao1215%2Fleadtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnao1215%2Fleadtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnao1215%2Fleadtime/lists"}