Skip to content

banjaminlee/Github_Follower_Bot_Automated

Repository files navigation

Alt text

GitHub Follower Bot Automated

Welcome to the GitHub Follower Bot Automated repository! This project is designed to help you automatically follow your GitHub followers, keeping your network growing and engaged with minimal effort.

✋✋✋You Follow Me ---> My Bot Follows you Back! Let's growth Together!✋✋🤘

🔵🔵🔵Let's also connect on LinkedIn

⭐⭐⭐⭐⭐ ---> Star the Repo!

📝 Usage

The bot will fetch your list of followers and automatically follow any users that are not already followed. A log of followed users is maintained in the followers.txt file. The bot will continue to run until all followers have been processed.

Additionally, the check_all_followers.py script allows you to monitor how many followers you have and how many you can follow based on your current GitHub API rate limits.

The bot can be run in two ways:

  1. Manually: You can run the bot manually on your local machine.
  2. Automatically with GitHub Actions: Set up the bot to run automatically on a schedule using GitHub Actions.

Project Structure

GitHub_Follower_Bot_Automated/
│
├── bot.py                    # Main script for the bot.
├── check_all_followers.py     # Script to check total followers and available follows.
├── followers.txt              # File where followed users are logged.
├── follower_counter.txt       # Total number of users followed across all runs.
├── requirements.txt           # Python dependencies.
├── .env                       # Environment variables (must be created).
├── bot.log                    # Log file for bot.py activities.
├── check_all_followers.log    # Log file for check_all_followers.py activities.
├── LICENSE                    # Project licensing information.
└── README.md                  # This readme file.

🚀 Features

  • Automated Follower Management: Automatically follows users who follow you on GitHub.
  • User-Friendly: Easy to set up and run, even for those with minimal technical knowledge.
  • Error Handling: Built-in error handling ensures smooth operation and reliability.
  • Logging: Comprehensive logs for tracking bot activity and performance.
  • Persistent Tracking: Maintains a persistent follower counter across multiple runs.
  • Rate Limit Awareness: Monitors GitHub API rate limits to prevent exceeding them.

🛠️ Setup & Installation To Run the Bot Manually on Local Server

Run the Bot Manually

1. Clone the Repository

Clone this repository to your local machine:

git clone https://github.com/OfficialCodeVoyage/GitHub_Follower_Bot_Automated.git
cd GitHub_Follower_Bot_Automated

2. Install Dependencies

Install the required Python packages using pip:

pip install -r requirements.txt

3. Configure Environment Variables

Create a .env file in the project root and add your GitHub username and Personal Access Token:

GITHUB_USER=your_github_username
PERSONAL_GITHUB_TOKEN=your_personal_access_token

Make sure you do not commit this file to the repository as it contains sensitive information. Create .gitignore file and add .env to it.

4. Run the Bot

Run the bot using the following command:

python follower_bot.py

🛠️ Setup & Installation To Run the Bot every 10 minutes with GitHub Actions(Automatically)

GitHub Actions Workflow Setup

To set up the bot to run automatically on a schedule using GitHub Actions, follow these steps:

1. Creating a Personal Access Token (PAT):

  1. Go to GitHub Settings: Navigate to your GitHub profile, click on your avatar in the upper-right corner, and select "Settings".
  2. Access Developer Settings: On the left sidebar, click on "Developer settings"(all the way to bottom / last button). Under "Developer settings", click on "Personal access tokens".
  3. Generate a New Token: Click the "Generate new token" button. Give your token a descriptive name like "GitHub Follower Bot Token".
  4. Select the Required Scopes: Choose the following scopes:
    • repo: Full control of private repositories.
    • workflow: Update GitHub Actions workflows.
    • admin:repo_hook: Manage webhooks and their events.
    • public_repo: Access to public repositories.
    • read:user: Read access to profile data.
    • write:repo_hook: Manage repository hooks.
    • user: Read and write access to profile information.
    • gist: Access to Gists (if needed).
  5. Generate and Save the Token: Click "Generate token" and copy the token immediately, as it will not be shown again.

2. Storing the PAT as a GitHub Secret:

  1. Navigate to Your Repository: Go to your repository on GitHub. Click on "Settings" in the repository menu.
  2. Add a New Secret: On the left sidebar, click on "Secrets and variables" under the "Security" section and select "Actions". Click "New repository secret".
  3. Name the secret PERSONAL_GITHUB_TOKEN: Paste the Personal Access Token you copied earlier into the "Secret" field and click "Add secret" to save it.

3. Updating the GitHub Actions Workflow File:

In your YAML file (e.g., automation.yml), update the following:

  1. Token Reference: Ensure your workflow is referencing the token correctly:
    env:
      GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
  2. Script Name: Replace bot.py with your actual script name in the run command:
    run: |
      python bot.py
  3. Dependencies: Make sure your requirements.txt is correct and that the path is correct if it's in a different directory.
  4. Cron Schedule: Adjust the cron expression to control when the workflow runs automatically:
    schedule:
      - cron: '0 0 * * *'  # Modify as needed

4. Monitoring the Workflow:

  • After setting up, monitor the workflow in the "Actions" tab of your repository to ensure it runs as expected.
  1. Commit and push the file to your repository.

4. Granting Workflow Permissions:

Ensure that your workflow has the necessary permissions by adding this to your YAML file:

permissions:
  contents: write  # Allows committing and pushing changes
  issues: write    # Allows creating and managing issues
  pull-requests: write  # Allows managing pull requests
  actions: write  # Allows updating GitHub Actions workflows

5. Monitoring the Workflow:

  • You can monitor the workflow runs in the "Actions" tab of your GitHub repository.
  • The bot will run automatically based on the schedule you set or manually from the Actions tab.

🤖 Bot Configuration

Environment Variables

  • GITHUB_USER: Your GitHub username.
  • PERSONAL_GITHUB_TOKEN: Your GitHub Personal Access Token for API access.

Optional Features

Additional features can be implemented as needed. Check the Issues and Discussions sections for ideas and contributions.

📈 Contributions

Contributions are welcome! Feel free to submit a pull request or open an issue for suggestions, bug reports, or feature requests.

To Contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b dev).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add some feature').
  5. Push to the branch (git push origin dev).
  6. Open a pull request.

🔒 License

This project is licensed under the MIT License. See the LICENSE file for more details.

📞 Support

For any questions or issues, please feel free to reach out via GitHub Issues or Discussions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages