Skip to content

GitHub tools to synchronize milestones or labels across all organization repositories.

License

Notifications You must be signed in to change notification settings

jackjia-ibm/github-sync-repos

Repository files navigation

github-sync-repos

Actions Status

GitHub tools to synchronize milestones or labels across all organization/user repositories.

Prerequisites

Installation

Install from npm registry.

npm install github-sync-repos -g

To upgrade, you can run the above command again.

Usage

To find command help, type gsr -h:

$ gsr -h
Usage: gsr [options] <command> [command-options]

Commands:
  gsr labels <command>        List/add/delete labels of organization or user.
                                                                   [aliases: lb]
  gsr milestones <command>    List/add/delete milestones of a repository.
                                                                   [aliases: ms]
  gsr repositories <command>  List repositories of organization or user.
                                                      [aliases: repos, repo, rp]

GitHub:
  --organization   Github organization name.
  --template-repo  Github template repository name.
  --username, -u   Github account username. Required if API token is empty.
  --password, -p   Github account password. Required if API token is empty.
  --token          Github API token. Required if username is empty.

Options:
  --version      Show version number                                   [boolean]
  --config       Path to JSON config file
  --format       Response format. Available values are: plain, json.
                                                              [default: "plain"]
  --verbose, -v  Show more processing details.        [boolean] [default: false]
  -h, --help     Show help                                             [boolean]

For each command, you can type gsr <command> -h to get more detail help.

Provide GitHub Crendentials

There are several ways to provide command line options. The priority of finding options are (from top to low):

  1. Command line options,
  2. Environment variables on command line,
  3. Environment variables defined in .env file,
  4. Config json file,
  5. Default option value shown in gsr -h.

With Command Line Options

You can use gsr --token <my-api-token> <command> to specify API token in command line.

With Environement Variable

Use GSR_ to prefix your capitalized option name as environment variable name. For example:

$ GSR_TOKEN=<my-api-token> GSR_ORGANIZATION=<my-org-name> GSR_TEMPLATE_REPO=<tpl> gsr ls-repos

If you are using Windows, you will need cross-env. Install with command npm install --g cross-env then you can prefix the above command with cross-env. For example:

$ cross-env GSR_TOKEN=<my-api-token> GSR_ORGANIZATION=<my-org-name> GSR_TEMPLATE_REPO=<tpl> gsr ls-repos

With .env File

You can put GSR_* environment variables into a .env file. Please note, the .env has to be in same folder where you issue gsr command.

For example, create a .env file with this content and put into folder where you usually run your gsr command:

GSR_ORGANIZATION=<my-org>
GSR_TEMPLATE_REPO=<my-tpl-repo>
GSR_TOKEN=<my-api-token>

With config json File

You can create a config json file with key/value of option name/value. For example, create a ~/.config/gsr.json with this content:

{
  "organization": "<my-org>",
  "template-repo": "<my-tpl-repo>",
  "token": "<my-api-token>"
}

Then use this command to use the config file:

$ gsr --config ~/.config/gsr.json [command]

About

GitHub tools to synchronize milestones or labels across all organization repositories.

Resources

License

Stars

Watchers

Forks

Packages

No packages published