{"id":13495080,"url":"https://github.com/benbalter/count-org-loc","last_synced_at":"2025-10-05T16:56:19.768Z","repository":{"id":61705552,"uuid":"48451403","full_name":"benbalter/count-org-loc","owner":"benbalter","description":"Count total lines of code across a GitHub organization","archived":false,"fork":false,"pushed_at":"2024-03-25T14:26:26.000Z","size":22,"stargazers_count":111,"open_issues_count":3,"forks_count":150,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-20T09:06:18.699Z","etag":null,"topics":["code-analysis","lines-of-code","loc"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/benbalter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2015-12-22T20:01:27.000Z","updated_at":"2024-12-25T13:35:59.000Z","dependencies_parsed_at":"2024-01-16T09:53:46.561Z","dependency_job_id":"99548f17-2007-45f5-8986-da8c453a26eb","html_url":"https://github.com/benbalter/count-org-loc","commit_stats":{"total_commits":22,"total_committers":8,"mean_commits":2.75,"dds":0.6818181818181819,"last_synced_commit":"362a1a7f2acb10908b412a732f3c61aec01a7a83"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/benbalter/count-org-loc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fcount-org-loc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fcount-org-loc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fcount-org-loc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fcount-org-loc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benbalter","download_url":"https://codeload.github.com/benbalter/count-org-loc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fcount-org-loc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278486278,"owners_count":25994941,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"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":["code-analysis","lines-of-code","loc"],"created_at":"2024-07-31T19:01:31.001Z","updated_at":"2025-10-05T16:56:19.752Z","avatar_url":"https://github.com/benbalter.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Count total lines of code across a GitHub organization\n\n## Usage\n\n1. `git clone https://github.com/benbalter/count-org-loc \u0026\u0026 cd count-org-loc`\n2. `gem install bundler`\n3. `script/bootstrap`\n4. `script/count [ORG_NAME | USER_NAME]`\n\n## Usage via GitHub Actions\n\nDon't want to set up a local development environment? You can run this script via GitHub Actions:\n\n1. Fork this repository into your account\n2. Navigate to the \"Actions\" tab of your fork\n3. Click the \"run\" workflow on the left side\n4. Click \"Run workflow\" on the right side\n5. Enter your org. or user name that you'd like to count lines of code for\n6. Click \"Run Workflow\"\n\nYou'll see the progress and count(s) in the job output (also available from the Actions tab).\n\nNote: If you'd like to count private repositories, as described below, you'll need to set an `ORG_GITHUB_TOKEN` GitHub Actions secret with your PAT.\n\n## How it works\n\nIt uses [Octokit.rb](https://github.com/octokit/octokit.rb) to fetch a list of your organization's (or user's) repositories (public or public and private), clone each, and [Cloc](https://github.com/AlDanial/cloc) to count the lines of code, number of files, comments, etc.\n\n## Example output for @whitehouse\n\n```\n-------------------------------------------------------------------------------\nFile                         files          blank        comment           code\n-------------------------------------------------------------------------------\npetitions                      247           5981          20274          28748\nwh-app-ios                     202           6929           7409          23451\nfitara                         112            711            481          10693\ncyber-acquisitions             110            709            490          10400\nomb_place                      163            781            972           8684\nwh-app-android                 123           1384            307           8382\nfortyfour                       51            591            702           3902\neducation-compliance-reports     3            192              4           2964\nchoropleth                       8            320            669           2579\nchoropleth_dataset              14             93            508            841\ndrushsubtree                     4            220            887            834\nservices_documentation          18            154            563            746\nbuildmanager                     3             95            400            302\npetitionssignatureform           3             19             48            184\nshunt                            3             42            183            130\npetitions-php-sdk                1             42            151            127\ntweetfetch                       3             29             74            125\ntweetserver                      3             30             74            109\ntwitterapi                       3             21             70             59\npetitions_thermometer            1              0              0             56\nnetstorage                       1             16             70             45\nlogger                           2             10             46             29\nwebform_submit_button            1              6             21             20\n-------------------------------------------------------------------------------\nSUM:                          1079          18375          34403         103410\n-------------------------------------------------------------------------------\n\n--------------------------------------------------------------------------------\nLanguage                      files          blank        comment           code\n--------------------------------------------------------------------------------\nCSS                              64           1984           1670          25321\nObjective C                      90           4910           2244          20331\nSASS                            242           3013           1045          16512\nPascal                          129           3079          20164          11263\nJavascript                       71            931           1519           8304\nJava                             66           1116            246           6882\nJSON                            125            182              0           5380\nPHP                              82            565           1914           3519\nC/C++ Header                    102           1979           5153           2545\nHTML                             32            209            258           1471\nXML                              47            149             28            920\nBourne Shell                      9             95             70            376\nGroovy                            5             22              4            140\nBourne Again Shell                1             20             21            123\nProlog                            2             25              0             74\nRuby                              6             25             31             69\nDOS Batch                         1             24              2             64\nPython                            1             25              4             63\nYAML                              4             22             30             53\n--------------------------------------------------------------------------------\nSUM:                           1079          18375          34403         103410\n--------------------------------------------------------------------------------\n```\n\n## Counting private repositories\n\nTo look at private repositories, you'll need to pass a [personal access token](https://github.com/settings/tokens/new) with `repo` scope as `GITHUB_TOKEN`. You can do this by adding `GITHUB_TOKEN=[TOKEN]` to a `.env` file in the repository's root.\n\nIf you are working with GitHub Enterprise and want to change your URL, simply add `GITHUB_ENTERPRISE_URL=https://\u003cghe-url\u003e/api/v3` to the `.env` file\n\n\nSample `.env` File :\n\n```bash\nGITHUB_TOKEN=\"\u003ctoken\u003e\"\nGITHUB_ENTERPRISE_URL=\"https://my-ghe.local/api/v3\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenbalter%2Fcount-org-loc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenbalter%2Fcount-org-loc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenbalter%2Fcount-org-loc/lists"}