Skip to content

SVENTRIPIKAL/Github-Follow-N-Star-Action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

234 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github-Follow-N-Star-Action ⭐

A daily Github Actions program that helps users follow back their Github followers & star their top-4 repositories. This repository uses Github Actions to automate this process and Vercel to simplify cloning this repository for users to their Github account.

Workflow Status Badge


Table of Contents

Initial Setup

  1. Clone The Repository 👨‍🔬

    • Deploy with Vercel
  2. Delete Data in your EXPLORED_LOGINS File 📄

  3. Create Github Actions Workflow 👨‍💻

    • Click Add File > Create New File in your Project Directory
    • Copy and Paste:
      • .github/workflows/actions.yml as the Name of your File
      • The Contents from actions.yml into your File
    • Click Commit Changes
  4. Grant Workflow Read/Write Permission ✍️

    • {Cloned_Repo_Name} > Settings > Actions > General
    • Scroll Down to Workflow Permissions
    • Click Read and Write Permissions
    • Click Save
  5. Create Personal Access Token 🥇

Warning

Copy your Personal Access Token value now. You won’t be able to see it again!

  1. Create Repository Secrets 🤐

    • {Cloned_Repo_Name} > Settings > Secrets and Variables > Actions

    • Create 2 Repository Secrets:

      1. PERSONAL_ACCESS_TOKEN

        • Bearer {Personal_Access_Token_Value}
      2. PERSONAL_USERNAME

        • {Your_Github_Username}
  2. Profit 💸


Running Actions Workflow

  • Manual:

    • Manual executions can be achieved by visiting the repository's Actions section, selecting the Follow-N-Star-Action workflow, and clicking Run Workflow
  • Scheduled:

    • The program is scheduled to execute @12pm every day. This can be changed in the .github/workflows/actions.yml file by adjusting the Cron Expression to fit your needs
on:
  schedule:
    - cron: '0 12 * * *'  # run @12pm every day

Actions Workflow Timing

  • Environment Setup:

    • ~8 seconds
  • Cost Per Follower:

    • ~7.28 seconds

Github API Rate Limit & Actions Allowance

Important

API Limit: 5,000 requests per/Hour | Actions Allowance: 2,000 minutes (500MB) per/Month.

Using the new Personal Access Token created earlier for this repository, API rates will be limited to 5,000 requests per hour, as well as a 2,000 minute (500MB) free monthly Actions allowance. Currently, the program only has a protection in place to prevent exceeding the user API limit rate:

def check_user_api_info(self, threshold=4000):

(line-102 in the model/github_api_client.py file, which can be increased), so it's advised that users keep track of their Actions usage. Adjusting the Cron Expression to execute the program less times a month can also help with this as well.

Tip

If the program stops early due to exceeding the API threshold, the workflow can be ran again after 1-hour once the user's API rate limit has refreshed, since the program saves explored profiles to file and continues with those not saved to file (as long as Actions minutes remain).


Running Project Locally

Cloning the project to your local machine will leave you with import errors & an inability for the program to access your github secrets. To remedy this, you need to create a quick virtual environment to install the project requirements, as well as a .env file containing your github secrets that can be accessed locally by the program as environment variables. Both will be located in your project's root directory. NOTE: options within { } are possible commands & outputs, so choose whichever relates to your setup.

Warning

Ensure venv directories & .env files are being ignored by git before pushing changes to your repository!

  1. Create Environment:
    {python|python3} -m venv venv
    
  2. Activate Environment:
    source ./venv/{bin|Scripts}/activate
    
  3. Verify Python & Pip Executables:
    (venv)
    which python pip
    
    > .../venv/{bin|Scripts}/python
    > .../venv/{bin|Scripts}/pip
    
  4. Install Project Requirements:
    (venv)
    pip install -r ./requirements.txt
    

Note

To consolidate project requirements, set your IDE's default interpreter to the environment's python.exe.

  1. Create a .env File with your Repository Secrets:

    PERSONAL_USERNAME = "{Your_Github_Username}"
    PERSONAL_ACCESS_TOKEN = "Bearer {Personal_Access_Token_Value}"
    

    Once complete, import errors will be gone & the program should run with successful Github API authentication. All project requirements can then be found in ./venv/Lib/../site-packages.


Output Example

Terminal Output Example


References

For more information explaining previous topics and all documentation used for creating this project, the following links have been curated:

Vercel
Personal Access Tokens
API Rates & Actions Allowances
REST API Endpoints & Practices
Github Actions
Python Virtual Environments
Securely Managing Environment Secrets

Inspiration

Grew tired of manually following users & starring more than 1 of their repos 😅

Releases

No releases published

Contributors

Languages