A Rust-based API service that provides seamless integration with GitHub's API. This project offers endpoints for repository management, file operations, and branch handling. Built with Axum framework, it provides a robust and efficient way to interact with GitHub repositories programmatically.
- Repository creation and management
- Branch creation and management
- File content retrieval and upload
- Environment-based branch handling
- Secure token-based authentication
- Rust
- Axum (Web Framework)
- Octocrab (GitHub API Client)
- Tokio (Async Runtime)
- Rust (latest stable version)
- Cargo (Rust's package manager)
- GitHub Personal Access Token
- Clone the repository:
git clone https://github.com/your-username/github-api-integration.git
cd github-api-integration- Set up your GitHub token:
# PowerShell
$env:GITHUB_TOKEN="your-github-token"
# Bash
export GITHUB_TOKEN="your-github-token"- Build and run the project:
cargo runThe server will start at http://localhost:3000
GET /api/github-file?url=<github-file-url>
Retrieves the contents of a file from a GitHub repository.
POST /api/github/repo
Creates a new repository and uploads a file to a specified branch.
Request body:
{
"owner": "your-username",
"repo": "repository-name",
"env": "development",
"main_branch": "main",
"file_name": "example.txt",
"file_content": "Hello, World!"
}GITHUB_TOKEN: Your GitHub Personal Access Token (Required)
The API returns standardized responses in the following format:
{
"success": boolean,
"message": string,
"data": object | null,
"error": string | null
}- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.