I started following people back on GitHub. First I thought this feature is useless. But since then I found a lot of interesting projects which I definitely would not have found. So I started this repository with some scripts to play around with the social features from GitHub.
- Clone the repo
git clone https://github.com/rueedlinger/ghfollow.git
-
Create a personal access token at https://github.com/settings/tokens/new?scopes=user:follow with only the access rights
user:follow
-
Create a
.env
env file. Just rename example.env and replace theGH_ACCESS_TOKEN
with your personal access token. Or save your access token as environment variableGH_FOLLOW_BACK_TOKEN
.
GH_ACCESS_TOKEN=***** SECRET TOKEN *****
- Install all required packages.
npm install
The Node script ghFollowBack.js
is for those who want to follow GitHub users back with just one click. Just run the script to follow people back. If GH_UNFOLLOW=true
set to true the script will also unfollow people which do not follow back.
node ghFollowBack.js
Store your personal access token as secret with the name GH_FOLLOW_BACK_TOKEN
and create a GitHub Action which
runs the ghFollowBack.js as a daily job
(See .github/workflows/followback.yml
).
name: FollowBack
on:
# Runs at 12:00 UTC every day.
# Note there might be some delays (minutes) when the job is triggerd.
schedule:
- cron: "0 12 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 12
- name: install modules
run: npm install
- name: run ghFollowBack.js
env:
# set the token as secret
GH_ACCESS_TOKEN: ${{ secrets.GH_FOLLOW_BACK_TOKEN }}
GH_UNFOLLOW: true
run: node ghFollowBack.js
The node scripts ghStarred.js
saves the latest starred repositories from people you follow in the CSV file starred.csv
. If the file already exists new entries are append if they do not exist yet. To check if a entry already exist the GitHub project id is used.
node ghStarred.js
To get some insights from people you follow on GitHub
jun can run the Jupyter notebook notebook/starred.ipynb. This notebook loads the data from starred.csv
file and plots the following charts.
Some of the files (*.png, *.ipynb
) are stored in Git LFS. When you want to work with them locally you need to install git-lfs and check them out.
git lfs checkout
@octokit/request
: https://github.com/octokit/request.js/- API Starring: https://docs.github.com/en/rest/reference/activity#starring
- API Followers: https://docs.github.com/en/rest/reference/users#followers