Skip to content

Command-line tool to fetch and display a GitHub user's recent activity using the GitHub API. This lightweight Go-based CLI helps you track contributions, issues, and other actions for any GitHub user.

Notifications You must be signed in to change notification settings

letsmakecakes/github-activity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Activity CLI

A simple command-line tool to fetch and display a GitHub user's recent activity using the GitHub API. This project helps you practice working with APIs, handling JSON data, and building a CLI in Go.

Features

  • Fetches and displays the recent activity of a GitHub user in the terminal.
  • CLI accepts the GitHub username as an argument.
  • Handles errors gracefully, including invalid usernames or API failures.
  • (Optional) Caching mechanism to improve performance.

Getting Started

Prerequisites

  • Go 1.18+
  • GitHub API token (if needed for higher rate limits)

Installation

  1. Clone the repository:

    git clone https://github.com/<your-username>/github-activity-cli.git
    cd github-activity-cli
  2. Install the necessary dependencies:

    go mod tidy
  3. Build the CLI tool:

    go build -o github-activity ./cmd/github-activity

Usage

  1. Run the tool by passing a GitHub username as an argument:

    ./github-activity <username>

    Example:

    ./github-activity kamranahmedse

    This will display the recent public activity of the specified user, like:

    - Pushed 3 commits to kamranahmedse/developer-roadmap
    - Opened a new issue in kamranahmedse/developer-roadmap
    - Starred kamranahmedse/developer-roadmap
    

Error Handling

The tool will gracefully handle common errors like:

  • Invalid GitHub usernames
  • Network issues or GitHub API failures
  • Rate-limiting by the GitHub API

In case of errors, appropriate messages will be displayed in the terminal.

Optional: Caching

You can enable caching to store the fetched activity data temporarily, reducing redundant API calls for the same user.

Project Structure

github-activity-cli/
├── cmd/
│   └── github-activity/
│       └── main.go                # CLI entry point
├── internal/
│   ├── api/
│   │   └── github.go              # GitHub API requests
│   └── model/
│       └── event.go               # Data model for GitHub events
├── pkg/
│   └── cli/
│       └── cli.go                 # CLI utilities or reusable logic
├── go.mod                         # Go module dependencies
├── go.sum                         # Go module checksums
└── README.md                      # Project documentation

API Reference

This tool uses the following GitHub API endpoint to fetch user activity:

GET https://api.github.com/users/<username>/events

For more details on the GitHub API, see the official documentation.

Future Enhancements

  • Filtering by event type: Filter events such as push, issue creation, starring, etc.
  • Structured output: Display activity in a more organized or structured format.
  • Additional API endpoints: Fetch more user-related data, like repositories, followers, etc.

About

Command-line tool to fetch and display a GitHub user's recent activity using the GitHub API. This lightweight Go-based CLI helps you track contributions, issues, and other actions for any GitHub user.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages