README
¶
GitLab Users Exporter
This Go script fetches user data from a GitLab instance and exports it to a CSV file.
Prerequisites
- Go installed on your machine
- GitLab instance with API access
Setup
-
Clone the repository:
git clone https://github.com/addhe/get_gitlab_user.git cd get_gitlab_user
-
Set environment variables:
GITLAB_TOKEN
: GitLab private token with API access.GITLAB_URL
: GitLab instance URL.
Example:
export GITLAB_TOKEN="<your-gitlab-token>" export GITLAB_URL="https://gitlab.example.com"
-
Build or run the script:
go build ./<executable-name>
go run get_gitlab_user.go
Functionality
The script performs the following tasks:
-
Fetch GitLab Users:
The script fetches a list of GitLab users by making API requests to the GitLab instance.
-
Export to CSV:
The fetched user data is exported to a CSV file named
users.csv
. The CSV file contains the following columns:- ID
- Username
- Name
- State
Adjusting Configuration
perPage
constant in the script determines the number of users fetched per API request. Modify it based on your needs.
Notes
-
Ensure that the provided GitLab token has the necessary permissions to access user information.
-
Adjust the
perPage
constant in the script according to your GitLab instance's capabilities and your preferences for pagination.
License
This project is licensed under the MIT License.
Documentation
¶
There is no documentation for this package.