A simple command-line interface (CLI) tool written in Go to fetch and display recent activity of a GitHub user. This project is built as a learning project following the specification from roadmap.sh GitHub User Activity Project.
- Activity Fetching: Fetches public activity events for any specified GitHub user using the GitHub API (
https://api.github.com/users/<username>/events). - Formatted Event Display: Formats event types (commits pushed, issues opened, repositories starred, etc.) into clean, human-readable terminal output.
- Error Handling: Gracefully handles errors such as non-existent users (404), network connectivity failures, and API rate limits.
- Zero External Dependencies: Built entirely using Go's standard library (
net/http,encoding/json,os,fmt).
- Go (version 1.20 or higher recommended)
-
Clone or navigate to the project directory:
cd github-user-activity -
Build the CLI executable:
go build -o github-activity main.go
Once built, you can execute commands using ./github-activity (or run directly using go run main.go <username>):
github-activity <username>github-activity kamranahmedseOutput:
Output:
- Pushed 3 commits to kamranahmedse/developer-roadmap
- Opened a new issue in kamranahmedse/developer-roadmap
- Starred kamranahmedse/developer-roadmap
The CLI formats and displays terminal output for common GitHub activity events:
PushEvent: Pushed commits to a repository.IssuesEvent: Opened, closed, or updated an issue.WatchEvent: Starred a repository.CreateEvent: Created a repository, branch, or tag.PullRequestEvent: Opened, closed, or merged a pull request.ForkEvent: Forked a repository.IssueCommentEvent: Commented on an issue or pull request.
- Project Specification: roadmap.sh GitHub User Activity Project