Freshly structured toolkit for automating a lightweight GitHub workflow:
- Keep a head branch (default
dev) alive by cloning it from the base branch when missing - Overwrite
README.mdon that branch with auto-generated content - Create and (optionally) merge a PR from head → base, once diffs exist
autopr_bot/
├─ bot.py # GitHub automation logic
├─ content.py # Random content generators
└─ ui/ # Tkinter desktop experience
main.py # Backwards-compatible script entry
ui.py # Thin launcher for the redesigned UI
- Python 3.9+
requests(install viapip install -r requirements.txtorpip install requests)- GitHub Personal Access Token (classic) with
reposcope
python ui.pyHighlights:
- Modern dark theme with status badges and live log stream
- Optional co-author section; enable it only when you want
Co-authored-bylines - Loop controls with interval spinbox and live indicators
- Preview generator to inspect the random PR/README copy before running anything
from autopr_bot import AutoPRBot
bot = AutoPRBot(
token="<YOUR_TOKEN>",
repo="owner/repo",
base_branch="main",
head_branch="dev",
# co_authors=[{"name": "Ada Lovelace", "email": "ada@example.com"}],
)
bot.run_once() # Single cycle
# bot.run_loop(120) # Continuous automation- Ensure the head branch exists (creates it from base if missing).
- Overwrite
README.mdon the head branch with new random content. - If commits exist, open a PR from head → base.
- Merge the PR automatically if creation succeeds.
- Validation Failed: No commits between – nothing changed; either wait or tweak content.
- 404s / 403s – usually incorrect
owner/repo, branch names, or token permissions. - Merge blocked – branch protection rules may prevent auto-merges.
- Rate limits – widen the loop interval or use fewer API calls.
- Prefer environment variables or secret managers for tokens; never commit them.
- Limit PAT scopes to
repo, or less if possible.
MIT