This is a command line interface(CLI) to fetch the recent activity of a GitHub user and display it in the terminal.
-
Working with extrernal APIs.
-
Handling JSON data.
-
Building a CLI interface.
-
Graceful error handling
-
No external libraries or frameworks to fetch the Github activity.
The application runs in the command line, accepts the Github username as arguement and an optional arguement that filters the activities by the event type.
Activities are fetched using the Github API and displayed in the terminal
-
Filtering by event type
-
Displaying activities in a structured way
- Node Js
- Docker
-
Clone the repository
git clone https://github.com/your-username/github-activity-cli.git cd github-activity-cli
-
Set Environment Variables: The github API requires authentication for certain request. To avoid rate limits, you can use a personal Github access token. Create a .env file and add the your access token.
GITHUB_TOKEN=<your_github_token>
-
Running the CLI: Compile the typecript file (index.ts) then call it with the required arguements.
tsc index.ts node --env-file=.env index.js <username> [event-type]
- [username] (required): The GitHub username whose recent activity you want to fetch.
- [event-type] (optional): Filter by the type of event (e.g., PushEvent, ForkEvent, etc.).
-
Basic Fetch (No Event Filter): To fetch all recent activities for a user
node --env-file=.env index.js ryankaleligabriel
-
Fetch and Filter by Event Type: To fetch only PushEvent activities
node --env-file=.env index.js ryankaleligabriel PushEvent
-
Pull the image from docker hub
docker pull ryankaleligabriel/github-activity-cli
-
Build the image
docker build -t ryankaleligabriel/github-acitvity-cli .
-
Run the image
docker run --name <your_container_name> -d -p 3000 -e GITHUB_TOKEN=<your_github_access_token> ryankaleligabriel/github-activity-cli <your_github_username> <event_type>(optional)
-
Check for your output
docker logs <your_container_name>
Recent Github activities for ryankaleligabriel
1. PublicEvent in RyanKaleliGabriel/Bookify at 2024-10-28T17:30:56Z
2. PushEvent in RyanKaleliGabriel/Bookify at 2024-10-28T16:49:22Z
If there are issues such as invalid username, rate limit issues, or network problems, the CLI will display appropriate error messages.