Skip to content

double-k-3033/Auto-PR-bot-v1.0

Repository files navigation

🤖 Auto PR Bot

A modern, automated GitHub Pull Request management tool with a beautiful GUI interface. This bot automatically creates, manages, and merges pull requests based on your configuration.

Python License Platform

✨ Features

  • 🎨 Modern GUI Interface - Beautiful, user-friendly interface built with Tkinter
  • 🔄 Automated Workflow - Automatically creates and merges PRs from dev → main
  • 📝 Smart Content Generation - Generates realistic PR titles and descriptions
  • 🔁 Continuous Loop Mode - Run continuously with configurable intervals
  • 📊 Real-time Activity Logs - Color-coded logs with emoji indicators
  • ⚙️ Flexible Configuration - Customize branches, intervals, and repository settings
  • 🔐 Secure Token Handling - Password-masked token input

📋 Requirements

  • Python 3.8+
  • GitHub Personal Access Token (classic) with repo scope
  • requests library (automatically installed via requirements.txt)

🚀 Quick Start

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/Auto-PR-bot-v1.0.git
    cd Auto-PR-bot-v1.0
  2. Install dependencies:

    pip install -r requirements.txt

Running the Application

Launch the GUI:

python app.py

The modern interface will guide you through the configuration process.

📖 Usage Guide

GUI Interface

  1. Configure Repository Settings:

    • 🔑 GitHub Token: Your Personal Access Token
    • 👤 Repository Owner: GitHub username or organization
    • 📦 Repository Name: Name of your repository
    • 🌿 Base Branch: Target branch (default: main)
    • 🔀 Head Branch: Source branch (default: dev)
    • ⏱️ Interval: Loop interval in seconds (default: 60)
  2. Choose Operation Mode:

    • ▶️ Run Once: Execute a single cycle
    • 🔄 Start Loop: Run continuously at specified intervals
    • ⏹️ Stop Loop: Stop the continuous loop
    • 🗑️ Clear Logs: Clear the activity log display

Programmatic Usage

You can also use the bot programmatically:

from src.bot import AutoPRBot

# Create bot instance
bot = AutoPRBot(
    token="ghp_your_token_here",
    repo="owner/repository",
    base_branch="main",
    head_branch="dev"
)

# Run once
bot.run_once()

# Or run in a loop (60 second intervals)
# bot.run_loop(60)

🔧 Project Structure

Auto-PR-bot-v1.0/
├── app.py                 # Application entry point
├── requirements.txt       # Python dependencies
├── README.md             # This file
├── .gitignore           # Git ignore rules
└── src/
    ├── __init__.py      # Package initialization
    ├── bot.py           # Core bot logic
    ├── config.py        # Configuration management
    └── ui.py            # Modern GUI interface

🔄 How It Works

The bot follows a simple workflow:

  1. Branch Validation - Ensures the head branch exists (creates if needed)
  2. Content Update - Updates README.md on the head branch with generated content
  3. PR Check - Checks for existing open PRs
  4. PR Creation - Creates a new PR if differences exist
  5. Auto-Merge - Automatically merges the PR
  6. Loop - Optionally repeats at specified intervals

🎯 Use Cases

  • Automated Testing - Continuously test your PR workflow
  • Demo & Training - Demonstrate Git/GitHub workflows
  • CI/CD Testing - Test continuous integration pipelines
  • Repository Maintenance - Automated routine updates

🔐 GitHub Token Setup

  1. Go to GitHub.comSettingsDeveloper settings
  2. Select Personal access tokensTokens (classic)
  3. Click Generate new token (classic)
  4. Give it a descriptive name
  5. Select scopes: ✓ repo (Full control of private repositories)
  6. Click Generate token
  7. Copy the token (you won't see it again!)

🛡️ Security Best Practices

  • ✅ Never commit tokens to version control
  • ✅ Use environment variables or secure vaults for tokens
  • ✅ Grant minimum required permissions
  • ✅ Rotate tokens regularly
  • ✅ Use tokens with limited scope for public repositories

⚠️ Troubleshooting

Common Issues

"Validation Failed: No commits between branches"

  • No differences exist between the branches
  • The bot will skip PR creation

"404 Not Found"

  • Check repository owner/name spelling
  • Verify token has correct permissions
  • Ensure branches exist

"Failed to merge PR"

  • Branch protection rules may prevent auto-merge
  • Check if PR requires reviews
  • Verify merge permissions

API Rate Limits

  • Increase the loop interval
  • GitHub has rate limits: 5,000 requests/hour for authenticated users

📊 Activity Log Icons

  • ✅ Success / Completed
  • ❌ Error / Failed
  • ⚠️ Warning
  • ℹ️ Information
  • 🤖 Bot Activity
  • 🔀 Merge Operation
  • 📋 Check Operation
  • 📝 Create Operation
  • ⏱️ Wait/Timing
  • 🔄 Loop Activity

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📝 License

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

🙏 Acknowledgments

  • Built with Python and Tkinter
  • Uses GitHub REST API
  • Inspired by modern DevOps automation practices

📧 Support

If you encounter any issues or have questions, please open an issue on GitHub.


Made with ❤️ by the Auto PR Bot Team

About

About An automation bot for GitHub: monitors repositories, creates pull requests automatically for dependency updates or branch merges, and integrates with CI/CD via GitHub Actions, streamlining dev workflows.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages