GithubHelp home page GithubHelp logo

padrien33 / gitlab-project-member-count Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 93 KB

The script will write the number of members for each project and their Git URLs to a text file named `project_id_members.txt`. The file will be saved in the same directory where the script is run.

License: Apache License 2.0

Python 100.00%

gitlab-project-member-count's Introduction

GitLab Project Member Count Script

This Python script retrieves the number of members for each project on a GitLab instance, as well as the total number of unique members across all projects.

Screenshot

It uses GitLab API, so you can add more filter on the API Call like restricting the repo that contains only Java by using the attribute: "with_programming_language" Change "projects_api_url" in gitlab_members.py For more details on the attribute you can use, please consult the documentation from GitLab:

GitLab Project API Doc

It will then create a text file, project_id_members.txt follwing this format:

Project ID: 20176*** (URL: https://gitlab.com/***/***/***.git): 2 members
Project ID: 17858*** (URL: https://gitlab.com/***/***.git): 1 members
Project ID: 16932*** (URL: https://gitlab.com/***/***.git): 1 members
Project ID: 15640*** (URL: https://gitlab.com/***/***.git): 3 members

Requirements

  • Python 3.6 or above
  • Requests library (pip install requests)

Setting Up

Before running this script, you need to set up an environment variable for your GitLab Private Token. This token is required for the script to authenticate with the GitLab API. You can generate a Private Token in the GitLab user settings.

The environment variable for the token should be named GITLAB_PRIVATE_TOKEN.

Setting the environment variable on Unix or Linux

export GITLAB_PRIVATE_TOKEN=your-private-token

Setting the environment variable on Windows

set GITLAB_PRIVATE_TOKEN=your-private-token

After setting the environment variable, it will be available for the current session. If you want to set it permanently, you would need to add the above command to your shell startup file or system environment variables, which is beyond the scope of this README.

Setup URL

By default it will use https://gitlab.com as the instance. Change the variable url to the hostname f your GitLab instance.

Downloading the script

If you do not already have the Python script, you can download it directly from this git repository using the following curl command:

curl -O https://raw.githubusercontent.com/padrien33/GitLab-Project-Member-Count/main/gitlab_members.py

Running the script

To run the script, simply use the following command:

python3 gitlab_member_count.py

The script will write the number of members for each project and their Git URLs to a text file named project_id_members.txt. The file will be saved in the same directory where the script is run.

gitlab-project-member-count's People

Contributors

padrien33 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.