Skip to content

GitHub CLI extension to list repo collaborators and their repo permissions in an EMU owned organization.

License

Notifications You must be signed in to change notification settings

katiem0/gh-collaborators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh-collaborators

A GitHub gh CLI extension to list and manage repository (outside) collaborators in a given organization.

Installation

  1. Install the gh CLI - see the installation instructions.

  2. Install the extension:

    gh extension install katiem0/gh-collaborators

For more information: gh extension install.

Usage

The gh-collaborators extension supports github.com and GitHub Enterprise Server, through the use of --hostname and the following commands:

$ gh collaborators -h
List and maintain repository collaborators and their assigned repositories.

Usage:
  collaborators [command]

Available Commands:
  add         Add repo access for repository collaborators.
  list        Generate a report of repos that repository collaborators have access to.
  remove      Remove repo access for repository collaborators.

Flags:
  -h, --help   help for collaborators

Use "collaborators [command] --help" for more information about a command.

List Collaborators

Repository permissions assigned to a Repository Collaborator can be listed and written to a csv file for an organization or specific user.

$ gh collaborators list -h
Generate a report of repositories guest collaborators have access to.

Usage:
  collaborators list [flags] <organization>

Flags:
  -d, --debug                To debug logging
  -h, --help                 help for list
      --hostname string      GitHub Enterprise Server hostname (default "github.com")
  -o, --output-file string   Name of file to write CSV list to (default "RepoCollaboratorsReport-20231211162953.csv")
  -t, --token string         GitHub Personal Access Token (default "gh auth token")
  -u, --username string      Username of single repo collaborator to generate report for

The output csv file contains the following information:

Field Name Description
RepositoryName The name of the repository where the data is extracted from.
RepositoryID The ID associated with the Repository, for API usage.
Visibility The visibility of the repository.
Username The username of the repository collaborator.
AccessLevel The repository access permissions granted to the repository collaborator.

Add Collaborators

Repository permissions can be assigned to a Repository Collaborator defined in a required csv file for an organization.

$ gh collaborators add -h 
Add repositories and permissions for repository collaborators.

Usage:
  collaborators add [flags] <organization>

Flags:
  -d, --debug              To debug logging
  -f, --from-file string   Path and Name of CSV file to create access from (required)
  -h, --help               help for add
      --hostname string    GitHub Enterprise Server hostname (default "github.com")
  -t, --token string       GitHub Personal Access Token (default "gh auth token")

The required csv file should contain the following information:

Field Name Description
RepositoryName The name of the repository that the user will be given access to.
Username The username of the repository collaborator.
AccessLevel The repository access permissions to grant the repository collaborator.

Remove Collaborators

Repository permissions can be removed for a Repository Collaborator defined in a required csv file for an organization.

$ gh collaborators remove -h                                         
Remove repositories and permissions for repository collaborators.

Usage:
  collaborators remove [flags] <organization>

Flags:
  -d, --debug              To debug logging
  -f, --from-file string   Path and Name of CSV file to remove access from (required)
  -h, --help               help for remove
      --hostname string    GitHub Enterprise Server hostname (default "github.com")
  -t, --token string       GitHub Personal Access Token (default "gh auth token")

The required csv file should contain the following information:

Field Name Description
RepositoryName The name of the repository that the user will be removed from.
Username The username of the repository collaborator.

About

GitHub CLI extension to list repo collaborators and their repo permissions in an EMU owned organization.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages