Skip to content

securancy/find-inactive-github-users

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Finding inactive organisation members

This repository is based on the GitHub platform sample code for finding inactive members, the original script can be found here: github/platform-samples.

This script queries the GitHub REST API to scan all members of the organisation. It checks for commits, issue creation, comments, and interactions with pull requests. These activities are compared to the specified cutoff date. Based on its findings it generates a simple CSV report, outputting both active and inactive members.

Prerequisites

You need to make sure you have Ruby installed (and it's up-to-date), follow these steps:

Install ruby

brew install ruby

Add ruby to your path

echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc

Refresh the terminal configuration

source ~/.zshrc

Generate the personal access token

  1. Go to the developer settings in your GitHub account and the fine-grained tokens page.
  2. Click generate new fine-grained token.
  3. Under the resource owner, select the organisation you want to scan.
  4. Configure the following read-only permissions:
    • In the organisations tab: members
    • In the repository tab: contents, issues, metadata and pull requests.
  5. Generate the token, copy and save the token.

Installation

Navigate to the script directory

cd find-inactive-github-members

Install the GitHub API client gem, perhaps with sudo

sudo gem install octokit

Authenticate your terminal session with your copied token, replace the <personal_access_token> string in the command below:

export OCTOKIT_ACCESS_TOKEN="<personal_access_token>"

Running the script

To run the script, use the following command. Make sure to replace <organisation> with the name of your organisation and adjust the cutoff date to whatever you want. This acts as a filter while querying data, so if you set it to three months ago. It will only query/analyse the data of the past three months.

Beware that GitHub has a rate limit of 5000 requests per hour.

ruby find_inactive_users.rb -o <organisation> -d "2025-05-25"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages