A Rust CLI that generates weekly Excel timesheets from GitHub issues, pull requests, and commits.
The application fetches GitHub activity for a configured user and writes one populated .xlsx workbook per week using the supplied timesheet template.
- Fetches GitHub issues and pull requests for a specific user within a date range
- Fetches commits authored by the configured GitHub user
- Fetches commits attached to pull requests so PR work across multiple days is included
- Filters items by:
- Assignment to the target user
- Creation by the target user
- Date range (created, updated, or closed within range)
- Places commits on the day they were committed/pushed in GitHub commit metadata
- Adds multiple same-day commits as separate tasks in the same Excel day row
- Ignores merge commits, including commits with multiple parents and messages starting with
Merge,Merged, orMerge: - Exports filtered records into Excel workbooks using a provided
.xlsxtemplate - Supports pagination for large result sets
src/
βββ main.rs # Application entry point and orchestration
βββ config.rs # Configuration loading from environment variables
βββ cli.rs # Command-line argument parsing
βββ github/
β βββ client.rs # GitHub API client
β βββ issues.rs # Issue fetching
β βββ prs.rs # Pull request fetching
β βββ commits.rs # Repository and PR commit fetching
βββ timesheet/
β βββ model.rs # GitHub and timesheet data structures
β βββ mapper.rs # GitHub-to-timesheet mapping and filtering
β βββ weeks.rs # Weekly grouping
β βββ excel.rs # Template-based Excel generation
βββ utils/dates.rs # Date parsing and week ranges
cargo build --releaseSet up environment variables in a .env file:
GITHUB_TOKEN=your_github_token_here
GITHUB_OWNER=repository_owner
GITHUB_REPO=repository_name
GITHUB_USER=your_github_usernamecargo run --release -- --file templates/TimesheetTemplate.xlsx --start 2026-04-26 --end 2026-05-18The application will generate one Excel workbook per week in output/, for example:
REPO_iamkabelomoobi_Week_1_2026-04-26_to_2026-04-26.xlsx
- Each workbook covers one generated week range.
- The workbook preserves the provided template and updates the header fields.
- Rows are populated by calendar day from row 8 onward.
- Issues and pull requests use their closed date when available, otherwise their updated date.
- Commits use the GitHub committer date.
- Multiple activities on the same day are joined in
Performed Project Task(s). - Workdays with activity default to
8hours. - Weekends and days without activity default to
0hours. - Merge commits are excluded from the timesheet.
The generated Excel files preserve the provided template and populate the weekly rows:
DateType of DayPerformed Project Task(s)Task StatusTotal HoursEmployee Comment
- Async/Await: Uses Tokio runtime for non-blocking I/O operations
- Error Handling: Comprehensive error types using
thiserrorcrate - Type Safety: Leverages Rust's type system for compile-time guarantees
- Modular Design: Clean separation of concerns across modules
- Pagination: Automatic handling of GitHub API pagination (100 items per page)
tokio- Async runtimereqwest- HTTP client with rustls-tls for TLS supportserde/serde_json- JSON serialization/deserializationchrono- Date/time handlingzip- Updates template workbook XML inside.xlsxfilesdotenvy- Environment variable loadingthiserror- Error handling
This project was migrated from JavaScript (Node.js) to Rust with the following improvements:
- Performance: Compiled binary vs. interpreted runtime
- Safety: Compile-time type checking and memory safety
- Error Handling: Structured error types instead of runtime errors
- Concurrency: Better async/await semantics than JavaScript promises
- Memory: Explicit memory management without garbage collection overhead