{"id":16123553,"url":"https://github.com/austenstone/github-usage-report","last_synced_at":"2026-03-01T07:34:50.771Z","repository":{"id":217959244,"uuid":"745219544","full_name":"austenstone/github-usage-report","owner":"austenstone","description":"Parse Github usage reports","archived":false,"fork":false,"pushed_at":"2025-11-20T00:06:28.000Z","size":3498,"stargazers_count":1,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-20T02:19:40.492Z","etag":null,"topics":["github","npm-package","usage-reports"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/github-usage-report","language":"TypeScript","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/austenstone.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["austenstone"]}},"created_at":"2024-01-18T21:48:03.000Z","updated_at":"2025-11-20T00:05:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"e40bf22d-fca7-44a4-b817-f93ecb76fe35","html_url":"https://github.com/austenstone/github-usage-report","commit_stats":null,"previous_names":["austenstone/github-usage-report"],"tags_count":7,"template":false,"template_full_name":"austenstone/typescript-node","purl":"pkg:github/austenstone/github-usage-report","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fgithub-usage-report","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fgithub-usage-report/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fgithub-usage-report/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fgithub-usage-report/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austenstone","download_url":"https://codeload.github.com/austenstone/github-usage-report/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fgithub-usage-report/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29964181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T06:55:38.174Z","status":"ssl_error","status_checked_at":"2026-03-01T06:53:04.810Z","response_time":124,"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","npm-package","usage-reports"],"created_at":"2024-10-09T21:17:14.248Z","updated_at":"2026-03-01T07:34:50.752Z","avatar_url":"https://github.com/austenstone.png","language":"TypeScript","funding_links":["https://github.com/sponsors/austenstone"],"categories":[],"sub_categories":[],"readme":"# GitHub Usage Report Library\n\nA TypeScript library to read and process GitHub usage data and model usage data from CSV files.\n\n## Features\n\n- Parse GitHub Actions usage reports from CSV files\n- Parse model usage reports (e.g., AI model interactions) from CSV files\n- Support for both streaming (async) and direct (sync) file reading\n- Works in both Node.js and web environments\n- TypeScript support with full type definitions\n- Optional line-by-line processing callbacks\n\n## Installation\n\n```bash\nnpm install github-usage-report\n```\n\n## Usage\n\nThis library supports both Node.js and web environments through different import paths:\n\n### Node.js Usage (with file system access)\n\nFor Node.js applications, you can import the full library which includes file reading capabilities:\n\n```typescript\nimport { readGithubUsageReportFile, readGithubUsageReportFileSync, readModelUsageReportFile, readModelUsageReportFileSync } from 'github-usage-report';\n\n// GitHub Actions usage reports\nconst githubReport = await readGithubUsageReportFile('path/to/usage-report.csv', (line) =\u003e {\n  console.log(`Processing: ${line.date} - ${line.product}`);\n});\n\n// Model usage reports  \nconst modelReport = await readModelUsageReportFile('path/to/model-usage.csv', (line) =\u003e {\n  console.log(`Processing: ${line.user} - ${line.model}`);\n});\n\n// Sync file reading\nconst report = await readGithubUsageReportFileSync('path/to/usage-report.csv');\nconsole.log(`Total lines: ${report.lines.length}`);\n```\n\n### Web/Browser Usage (without file system dependencies)\n\nFor web applications or environments where you don't need file system access, import from the core module:\n\n```typescript\nimport { readGithubUsageReport, readModelUsageReport } from 'github-usage-report/core';\n\n// Parse GitHub Actions CSV data from string (e.g., from a file upload or API)\nconst githubCsvData = `Date,Product,SKU,...\n2023-01-01,Actions,minutes,...`;\n\nconst githubReport = await readGithubUsageReport(githubCsvData);\n\n// Parse model usage CSV data from string\nconst modelCsvData = `Timestamp,User,Model,Requests Used,Exceeds Monthly Quota,Total Monthly Quota\n2025-06-02T22:34:09Z,bspann,claude-sonnet-4,1.00,false,Unlimited`;\n\nconst modelReport = await readModelUsageReport(modelCsvData);\n```\nconsole.log(`Report covers ${report.days} days from ${report.startDate} to ${report.endDate}`);\n```\n\n### Universal Usage\n\nYou can also import specific functions based on your needs:\n\n```typescript\n// Import only what you need from core (works everywhere)\nimport { readGithubUsageReport, readModelUsageReport, UsageReport, UsageReportLine, ModelUsageReport, ModelUsageReportLine } from 'github-usage-report/core';\n\n// Import Node.js specific functions (works only in Node.js)\nimport { readGithubUsageReportFile, readGithubUsageReportFileSync, readModelUsageReportFile, readModelUsageReportFileSync } from 'github-usage-report/node';\n```\n\n### Report Structure\n\nThe library returns different report objects based on the data type:\n\n#### GitHub Usage Report\n```typescript\n{\n  startDate: Date,     // First date in the report\n  endDate: Date,       // Last date in the report  \n  days: number,        // Number of days covered\n  lines: UsageReportLine[] // Array of parsed GitHub usage data\n}\n```\n\n#### Model Usage Report\n```typescript\n{\n  startDate: Date,     // First timestamp in the report\n  endDate: Date,       // Last timestamp in the report  \n  days: number,        // Number of days covered\n  lines: ModelUsageReportLine[] // Array of parsed model usage data\n}\n```\n\n### Model Usage Report Format\n\nThe model usage report expects CSV files with this format:\n\n```csv\nTimestamp,User,Model,Requests Used,Exceeds Monthly Quota,Total Monthly Quota\n2025-06-02T22:34:09Z,bspann,claude-sonnet-4,1.00,false,Unlimited\n2025-06-02T22:35:15Z,jdoe,gpt-4,2.50,false,100\n```\n\n**Fields:**\n- **Timestamp**: ISO 8601 format (e.g., `2025-06-02T22:34:09Z`)\n- **User**: String username\n- **Model**: String model name\n- **Requests Used**: Numeric value (can be decimal)\n- **Exceeds Monthly Quota**: Boolean (`true` or `false`)\n- **Total Monthly Quota**: String (either \"Unlimited\" or a numeric value)\n\n## Getting Your GitHub Usage Report\n\nTo generate a GitHub usage report:\n\n1. Go to your GitHub organization or personal account settings\n2. Navigate to \"Billing and plans\" → \"Actions\"\n3. Click \"Usage\" and export your data as CSV\n\nSee [Viewing your GitHub Actions usage](https://docs.github.com/en/billing/managing-billing-for-github-actions/viewing-your-github-actions-usage) for detailed instructions.\n\n## Development\n\n### 🔨 Build\n```bash\nnpm run build\n```\n\n### 🧪 Test\n```bash\nnpm test\n```\n\n### 🏃 Run\n```bash\nnpm start\n```\n\n### 🧹 Lint \n```bash\nnpm run lint\n```\n\n## License\n\nThis project is open source.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustenstone%2Fgithub-usage-report","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustenstone%2Fgithub-usage-report","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustenstone%2Fgithub-usage-report/lists"}