GitHub-ContriBot is a GitHub Actions based automation project that performs a complete contribution lifecycle inside your repository.
Each successful bot cycle can:
- create a new issue
- assign the issue to your account
- create a temporary update branch from
main - modify
contribution_log.txt - commit and push the branch
- create a pull request into
main - assign the pull request to your account
- submit a review
- merge the pull request
- close the issue through the PR body
- delete the temporary branch
The current design is built specifically to avoid workflow loops. The automation runs only from scheduled triggers and manual workflow dispatches. It does not run on push, so bot-created merges do not recursively trigger new runs.
The project has three main parts:
Automator.py: the Python automation script.github/workflows/main.yml: the GitHub Actions workflow.bot_state.json: the persistent daily quota state
The workflow checks out the repository, installs dependencies, configures git, and runs Automator.py.
The Python script is responsible for:
- tracking the current day's quota
- deciding whether another cycle should run
- creating the issue / branch / PR / review / merge sequence
- updating the state after a successful cycle
The bot no longer relies on fixed morning and night execution windows.
Instead, it uses a daily random target:
- at the start of a new UTC day, the bot selects a random
daily_targetfrom1to25 - each workflow run performs at most one complete contribution lifecycle
- after each successful lifecycle, the bot increments
completed - once
completed == daily_target, later runs for that day exit without making changes
Example:
{
"date": "2026-03-19",
"daily_target": 17,
"completed": 4
}This means the bot will continue producing one new issue -> PR -> merge cycle per scheduled run until it reaches 17 for that day.
The GitHub Actions workflow is configured with:
scheduleworkflow_dispatchconcurrency
It prevents two bot runs from executing at the same time. This avoids branch collisions, duplicated PR creation, and quota race conditions.
This is the key fix for the looping problem.
When the bot merges a pull request into main, that merge creates a new commit in the repository. If the workflow listened to push, the merge would trigger the bot again and create an automation loop.
By using only scheduled and manual triggers:
- merges to
maindo not trigger the bot - only the scheduler or a manual run can start a new cycle
During one successful execution, the bot performs the following:
- Sync local checkout to the latest
main - Read
.bot_state.json - If it is a new day, generate a new random target between
1and25 - If the day's quota is already complete, exit cleanly
- Create a fresh branch such as
update-20260319093000-5 - Append a new entry to
contribution_log.txt - Commit the change
- Push the branch to GitHub
- Create an issue
- Assign that issue to the configured GitHub user
- Create a PR from the temporary branch to
main - Assign the PR to the configured user
- Submit a review
- Merge the PR into
main - Delete the temporary branch
- Update
.bot_state.jsonwith the new completed count
GitHub does not allow a user to approve their own pull request.
Because of that, the bot uses this logic:
- first it tries to submit an approval review
- if GitHub rejects it because the PR author and reviewer are the same account, it falls back to a review comment
This keeps the workflow running successfully in a single-account setup.
If you want actual approval reviews, you need:
- a second GitHub account, or
- a separate token belonging to another reviewer identity
Create your own copy of this repository on GitHub.
The bot opens PRs against main and synchronizes from main.
If your default branch is not main, update the branch constant in Automator.py.
Open the repository on GitHub and make sure Actions are enabled.
Go to:
Settings -> Secrets and variables -> Actions
Add these secrets:
PAT_TOKENCOMMIT_USERNAMECOMMIT_EMAIL
Use a GitHub Personal Access Token that has enough permission to:
- read and write repository contents
- create and manage issues
- create and merge pull requests
For a classic token, repo is the important scope. If you use a fine-grained token, give it equivalent repository permissions.
This must be your GitHub username. The bot uses it for issue assignment and PR assignment.
This should be an email address linked to your GitHub account. If the email is not linked to your account, merged commits may not show correctly in your contribution graph.
Scheduled GitHub Actions workflows run only when the workflow file exists on the repository's default branch.
If you build changes in Version-2.0 or any other branch, you must merge them into main before expecting scheduled runs to start automatically.
To test the automation immediately:
- Open your repository on GitHub
- Go to the
Actionstab - Select the
Daily Contributionworkflow - Click
Run workflow
Expected result for a successful run:
- one new issue is created
- one new PR is created
- the PR is merged into
main - the state file is updated
- the workflow run shows a green check mark
The workflow is currently configured to run hourly.
That means:
- GitHub creates a new workflow run on the cron schedule
- each run checks whether the daily quota is already complete
- if quota is available, one new lifecycle is executed
- if quota is already met, the run exits without creating more activity
So the Actions tab may show many runs in a day, but only some of them will create a new PR and merge depending on the current quota state.
This bot is designed to create contribution-related activity such as:
- merged commits on the default branch
- issues
- pull requests
- review comments or approval attempts
Whether those appear on your GitHub contribution graph depends on GitHub's contribution rules, your account email configuration, and whether the repository qualifies for profile contributions.
You can adjust the bot behavior by changing:
- the daily quota range in
Automator.py - the workflow schedule in
.github/workflows/main.yml - the base branch name
- the labels applied to issues and PRs
- the file changed in each cycle
Automator.py: main automation logic.github/workflows/main.yml: scheduler and workflow definition.bot_state.json: persistent state for quota trackingcontribution_log.txt: file updated by the botrequirements.txt: Python package dependencies
Check these points:
- the workflow file is present on
main - Actions are enabled in the repository
- the workflow has already been merged into the default branch
This is normal. Scheduled GitHub workflows are not always visible instantly after the workflow is merged into the default branch. Wait for the next cron interval.
If you are using only one GitHub account, GitHub will not allow self-approval of PRs. The bot now handles this by falling back to a review comment.
Check:
COMMIT_EMAILmatches an email linked to your GitHub account- commits are being merged into the default branch
- issues and PRs are being created in a repository that counts toward profile contributions
This project is licensed under the MIT License. See LICENSE for full details.
Pareekshith Palat
- GitHub: PareekshithPalat
- Email: pareekshithpalat@gmail.com
Use this automation responsibly and verify that the configured permissions, repository settings, and contribution expectations match your GitHub setup.
