This project automates the process of creating Git branches, making changes, committing them, pushing to a remote repository, creating pull requests, and merging them. It is designed to streamline repetitive tasks for developers and ensure consistency in branch naming and commit messages. Read The Full Detailed Article on This Project
- Automated Branch Creation: Generates meaningful branch names using random combinations of words and numbers.
- File Modification: Creates or modifies a file (
text.txt
) with a small change. - Git Integration: Automates adding, committing, and pushing changes to a remote repository.
- Pull Request Management: Creates and merges pull requests using the GitHub CLI (
gh
). - Customizable Execution: Allows users to specify the number of iterations and delay between runs to avoid rate-limiting issues.
Before running this script, ensure you have the following:
- Python: Installed on your system (Python 3.x recommended).
- Git: Installed and configured with access to your repository.
- GitHub CLI (
gh
): Installed and authenticated with your GitHub account. - Repository Setup: The script assumes it is run in a Git repository with a
main
branch.
-
Clone this repository:
git clone https://github.com/OCEANOFANYTHING/achieve-pull-shark-and-pair-extraordinaire-badge-with-ease.git cd achieve-pull-shark-and-pair-extraordinaire-badge-with-ease
-
Make a new repository on GitHub and clone it to your local machine.
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name
-
Copy the
main.py
script into your cloned repository.
-
Make sure you are in the
main
branch of your repository.git checkout main
-
Run the script:
python main.py
-
Follow the prompts:
- Enter the number of iterations you want the script to run.
- Specify the delay (in seconds) between iterations. The minimum delay is 100 seconds to avoid rate-limiting issues.
How many times do you want to run the script? 3
How long do you want to wait between runs? (in seconds) 120
The script will:
- Generate a new branch name.
- Create the branch.
- Add or modify
text.txt
with a small change. - Commit the changes with a pre-defined message.
- Push the branch to the remote repository.
- Create a pull request and merge it into the
main
branch. - Repeat the process for the specified number of iterations.
main.py
: The main script that handles all automation tasks..gitignore
: Specifies files and directories to be ignored by Git.LICENSE
: MIT License for the project.README.md
: Documentation for the project.
gen_branch_name()
: Generates a random branch name using predefined word lists and a numeric suffix.create_branch(branch_name)
: Creates a new Git branch.switch_branch(branch_name)
: Switches to an existing branch.run_command(command)
: Executes shell commands and handles output/errors.create_file(file_path)
: Creates a file (text.txt
) if it doesn't already exist.add_change_to_text_file(file_path)
: Appends a small change totext.txt
.main()
: Orchestrates the entire process, including branch creation, file modification, Git operations, and pull request management.
- Branch Naming: Modify the word lists in
gen_branch_name()
to customize branch names. - Commit Message: Update the
COMMIT_MESSAGE
constant to change the default commit message. - Co-Authors: Update
COAUTHOR_1
andCOAUTHOR_2
constants to include different co-authors.
- Ensure you have write access to the repository where the script is executed.
- The script uses the GitHub CLI (
gh
) for pull request creation and merging. Make sure it is installed and authenticated.
This project is licensed under the MIT License.
Contributions are welcome! Feel free to submit issues or pull requests to improve the project.
This script is provided "as is" without warranty of any kind. Use it at your own risk.
This Script is intended for educational purposes and to help developers automate repetitive tasks. Always ensure you understand the code and its implications before running it in a production environment.
this project is made for fun and to help developers achieve the "Pull Shark" and "Pair Extraordinaire" badges on GitHub. It is not intended for malicious use or to spam repositories. Always respect the guidelines and policies of the platforms you are using. Use responsibly and ethically.
If you find this project helpful and would like to support its development, consider buying me a coffee! Your support is greatly appreciated.