Automates a simple GitHub workflow:
- Ensure head branch exists (default
dev) - Overwrite
README.mdon head branch - Create PR from head → base (default
dev→main) - Auto-merge the PR
- Python 3.8+
- GitHub Personal Access Token (classic) with
reposcope requestslibrary (pip install requests)
python ui.pyFill in:
- Token: your GitHub PAT
- Username/Owner: e.g.,
octocat - Repository: e.g.,
hello-world - Base Branch: e.g.,
main - Head Branch: e.g.,
dev - Uptime (seconds): loop interval
Buttons:
- Run Once: single cycle (ensure branch → overwrite README → PR → merge)
- Start Loop: run every N seconds
- Stop Loop: stop background loop
from main import AutoPRBot
bot = AutoPRBot(
token="<YOUR_TOKEN>",
repo="owner/repo",
base_branch="main",
head_branch="dev",
)
# Single cycle
bot.run_once()
# Continuous loop every 60 seconds
# bot.run_loop(60)- If the head branch does not exist, it is created from the base branch
README.mdon the head branch is overwritten using the Contents API- If there are diffs, a PR from head → base is created
- The PR is merged automatically
- If you see "Validation Failed: No commits between", there were no diffs to PR.
- 404 errors usually indicate wrong
owner/repo, branch names, or insufficient token permissions. - Merge may fail if branch protection rules block auto-merge.
- API rate limits: increase the loop interval.
- Use least-privilege tokens. For private repos,
reposcope is required. - Avoid hardcoding tokens; the UI uses in-memory token entry.
MIT