Skip to content

A comprehensive .NET console application for GitHub integration with advanced repository management capabilities. Features include repository browsing, commit analysis, pull request management, code search, and repository statistics - all through an intuitive console interface.

Notifications You must be signed in to change notification settings

Darko-Martinovic/GitHubIntegration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ™ GitHub Integration Console Application

A powerful .NET console application that provides seamless integration with GitHub's API using the Octokit library, offering a beautiful and interactive interface for managing repositories, commits, pull requests, and advanced GitHub operations.

✨ Features

πŸ” Authentication & User Info

  • Test GitHub API connection with personal access token
  • Display comprehensive user profile information
  • Validate permissions and token validity

πŸ“‚ Repository Management

  • List all accessible repositories (owned + collaborator)
  • Show repository metadata (language, stars, forks, privacy status)
  • Filter and sort repository information

πŸ“‹ Commit Operations

  • View recent commits from any repository
  • Display commit details with author information
  • Navigate through commit history with pagination

πŸ“ File Operations

  • Retrieve file content from any repository
  • Support for different branches
  • Display file content in a formatted panel

πŸ”€ Pull Request Management

  • List pull requests with state filtering (open, closed, all)
  • View detailed pull request information
  • Add comments to pull requests
  • Create pull request reviews (approve, request changes, comment)

πŸ“Š Repository Intelligence

  • View repository statistics (contributors, languages, branches, tags)
  • Browse repository file structure
  • Navigate directories and files with tree view

πŸ” Search & Discovery

  • Search code across repositories
  • Search repositories by query
  • Advanced search with filters and operators

πŸš€ Quick Start

Prerequisites

  • .NET 9.0 SDK or later
  • GitHub Personal Access Token
  • Git (for cloning the repository)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd GitHubIntegration
  2. Configure environment variables

    Copy the example environment file:

    cp .env.example .env

    Edit .env and add your GitHub credentials:

    GITHUB_TOKEN=ghp_your_personal_access_token_here
    GITHUB_REPO_OWNER=your_github_username
    GITHUB_REPO_NAME=your_default_repo_name
  3. Install dependencies

    dotnet restore
  4. Run the application

    dotnet run

πŸ”§ Configuration

GitHub Personal Access Token Setup

  1. Go to GitHub β†’ Settings β†’ Developer settings β†’ Personal access tokens
  2. Generate a new token with the following scopes:
    • repo - Full repository access
    • read:user - Read user profile
    • read:org - Read organization membership (optional)

Environment Variables

Variable Description Required
GITHUB_TOKEN Your GitHub Personal Access Token βœ…
GITHUB_REPO_OWNER Your GitHub username βœ…
GITHUB_REPO_NAME Default repository name ❌

🎯 Usage

Main Menu Navigation

The application provides an intuitive console interface with submenu navigation:

Main Menu

  1. πŸ” Test Connection & Show User Info - Validate your GitHub connection and display profile
  2. πŸ“‚ List Accessible Repositories - Browse all repositories you have access to
  3. πŸ“‹ List Recent Commits - View recent commits from any repository
  4. πŸ“ Get File Content - Retrieve and display file contents
  5. 🧾 Commit Details - View detailed commit information
  6. πŸ”€ List Pull Requests - View pull requests with filtering
  7. πŸ‘€ Get Pull Request Details - View detailed PR information
  8. πŸ“Š Repository Statistics - View repository analytics
  9. πŸ”§ PR Management - Add comments and create reviews
  10. πŸ” Search & Discovery - Search code and repositories
  11. πŸ“ Repository Browser - Browse file structure
  12. ❌ Exit - Close the application

Submenus

  • PR Management: Add PR comments, Create PR reviews
  • Search & Discovery: Code search, Repository search
  • Repository Browser: Browse repository structure

Example Interactions

Testing Connection

πŸ” Test Connection & Show User Info
βœ… Connection successful!

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Property    β”‚ Value           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Username    β”‚ your-username   β”‚
β”‚ Name        β”‚ Your Full Name  β”‚
β”‚ Email       β”‚ your@email.com  β”‚
β”‚ Location    β”‚ Your City       β”‚
β”‚ Public Reposβ”‚ 25              β”‚
β”‚ Followers   β”‚ 150             β”‚
β”‚ Following   β”‚ 75              β”‚
β”‚ Created     β”‚ 2020-01-15      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Repository Listing

πŸ“‚ Found 15 repositories:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Name                β”‚ Language β”‚ Starsβ”‚ Forksβ”‚ Private β”‚ Updated    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ your-username/repo1 β”‚ C#       β”‚ 45   β”‚ 12   β”‚ 🌐      β”‚ 2024-01-15 β”‚
β”‚ your-username/repo2 β”‚ Python   β”‚ 23   β”‚ 8    β”‚ πŸ”’      β”‚ 2024-01-10 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—οΈ Architecture

Project Structure

GitHubIntegration/
β”œβ”€β”€ Models/
β”‚   β”œβ”€β”€ GitHubSettings.cs          # Configuration model
β”‚   └── RepositoryStatistics.cs    # Repository statistics model
β”œβ”€β”€ Services/
β”‚   β”œβ”€β”€ IGitHubService.cs          # GitHub service interface
β”‚   β”œβ”€β”€ GitHubService.cs           # GitHub API implementation using Octokit
β”‚   β”œβ”€β”€ ConsoleUIService.cs        # Console UI and interactions
β”‚   └── ConfigurationService.cs    # Configuration management
β”œβ”€β”€ Program.cs                     # Application entry point
└── GitHubIntegration.csproj       # Project configuration

Key Components

  • GitHubService: Handles all GitHub API interactions using Octokit
  • ConsoleUIService: Manages the beautiful console interface using Spectre.Console
  • ConfigurationService: Loads and validates environment variables
  • Dependency Injection: Properly configured services for testability

πŸ› οΈ Development

Building from Source

dotnet build

Running Tests

dotnet test

Code Style

The project follows C# coding conventions and uses nullable reference types.

πŸ“¦ Dependencies

  • Octokit: Official GitHub API client library for .NET
  • Spectre.Console: Beautiful console UI components
  • Microsoft.Extensions.Configuration: Configuration management
  • Microsoft.Extensions.DependencyInjection: Dependency injection container
  • Microsoft.Extensions.Logging: Structured logging
  • DotNetEnv: Environment variable loading from .env files
  • Repository browsing and navigation
  • Advanced PR operations

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Troubleshooting

Common Issues

"GITHUB_TOKEN environment variable is required"

  • Ensure your .env file exists and contains the correct token
  • Verify the token has the required scopes

"Connection failed"

  • Check your internet connection
  • Verify your GitHub token is valid and not expired
  • Ensure the token has the correct permissions

"Repository not found"

  • Verify the repository owner and name are correct
  • Ensure you have access to the repository
  • Check if the repository is private and your token has access

πŸ“ž Support

For issues and questions:

  1. Check the troubleshooting section above
  2. Review GitHub API documentation
  3. Open an issue in the repository

Happy coding! πŸš€

About

A comprehensive .NET console application for GitHub integration with advanced repository management capabilities. Features include repository browsing, commit analysis, pull request management, code search, and repository statistics - all through an intuitive console interface.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages