Automating GitHub Follower
Managing your GitHub followers manually can be time-consuming. Thankfully, with the "follower-sync" action, you can automate this task effortlessly. Here's how it works
Setting up Workflow Folder
To begin automating GitHub follower management with the "follower-sync" action, the first step is to create the .github/workflows folder within your repository. The .github folder is a special directory recognized by GitHub.
Configure Secrets
For the 'follower-sync' action, you'll need to configure the PERSONAL_ACCESS_TOKEN
. However, if you wish to receive email notifications for follower changes, you'll also need to set up secrets for your email credentials and the recipient's email address.
PERSONAL_ACCESS_TOKEN
is required for authentication purposes, allowing the actions to access your GitHub account and perform actions like fetching follower data and managing followers. Ensure that this token has the necessary permissions, typically at least the user scope permission, to perform the required actions.MAIL_USERNAME
andMAIL_PASSWORD
these secrets are used for sending email notifications. They represent the username and password for the email account that will be used to send notifications.TO_EMAIL_ADDRESS
: This secret represents the email address where you want to receive follower change notifications. Provide your desired email address here to receive notifications about any changes in your GitHub followers.
By configuring these secrets in your GitHub repository's settings, you ensure that sensitive information such as access tokens and email credentials are kept secure and are only accessible to authorized workflows within your repository. Make sure to follow best practices for managing secrets, such as avoiding hardcoding them directly in the workflow files and regularly rotating them for security purposes.
Trigger Setup
This sets up the workflow to run on a schedule using cron syntax, triggering it every day at 1:15 PM. Additionally, it can be manually triggered via the GitHub Actions UI. You can configure the schedule according to your needs by adjusting the cron expression.
Follower Change Notification Job
If you're solely interested in automating GitHub follower management with the "follower-sync" action and don't require email notifications or follower change notifications, you can skip this part.
However, if you'd like to receive email notifications for follower changes, follow along as we set up the Follower Change Notification Job.
This job is responsible for detecting changes in GitHub followers. It uses the "follower-change" action to monitor follower activity. If any unfollow events are detected, it sends an email notification using the "action-send-mail" action.
Cleanup Follower Job
Remove needs: [follower-notifier]
if you're not interested in follower change notifications.
If you want to fork the repository and customize it for your own test here is github link Follower Sync
The safe-list input allows you to specify GitHub usernames that should not be unfollowed during the cleanup process. It is a multiline input, meaning each username should be listed on a new line for example -
Cleanup follower job automatically cleans up the GitHub followers list. It utilizes the "follower-sync" action to follow and unfollow users, enhancing follower management efficiency.
Conclusion
By leveraging the "follower-sync" action in your GitHub Actions workflow, you can automate the process of managing GitHub followers effectively.