@hutson/github-metadata-sync
Synchronize GitHub metadata, such as labels, milestones, permissions, etc., across multiple GitHub projects.
Table of Contents
Features
- Project Labels
- [x] Create a new label.
- [x] Update metadata for a label, such as color, or description.
- [ ] Change label name to a new name.
- [x] Delete labels that are not listed in the configuration.
- Project Milestones
- [ ] Create a new milestone.
- Project Settings
-
[x] Issues enabled/disabled.
-
[x] Projects enabled/disabled.
-
[x] Wiki enabled/disabled.
-
[x] Default branch.
-
[x] Merge commit enabled/disabled.
-
[ ] Collaborators.
-
Installation
To install the github-metadata-sync
tool please run the following command:
yarn [global] add [--dev] @hutson/github-metadata-sync
Usage
There are two ways to use github-metadata-sync
, either as a CLI tool, or programtically.
CLI Tool
After you've installed github-metadata-sync
, you can call the tool based on whether you installed it globally or locally:
Globally
github-metadata-sync --config <path/to/config.json> --token <token>
Locally
$(yarn bin)/github-metadata-sync --config <path/to/config.json> --token <token>
Programmatically
CLI Options
The following CLI options are supported and can be passed to github-metadata-sync
:
--config <path/to/config.json>
An absolute or relative path to a JSON configuration file containing the metadata to be synchronized.
github-metadata-sync --config <path/to/config.json> --token <token>
The JSON configuration file should have the following form:
[
{
"repositories": [
"org/project",
"another-org/another-project"
],
"labels": [
{
"name": "defect",
"description": "Functionality not meeting the documented behavior for that project.",
"color": "FF0000"
}
],
"settings": {
"issues": true,
"projects": true,
"wiki": true,
"defaultBranch": "master",
"squashMerge": true,
"mergeCommit": true,
"rebaseMerge": true
}
}
]
Note: You can have groups of repositories such that each repository group has its own label set.
--token
A GitHub personal access token with the repo
scope selected.
The GitHub personal access token must be associated with an account that has Write permissions on the repositories that will be synchronized.
[--endpoint ]
If you are synchronizing projects on a GitHub Enterprise instance, such as an on-premise deployment at a company, you will need to pass the API endpoint of your deployment to the --endpoint
option.
github-metadata-sync --config <path/to/config.json> --token <token> --endpoint https://api.example.com/
Required GitHub Enterprise Edition
Version 2.13, or higher, of GitHub Enterprise is required for github-metadata-sync
.
Core features used:
This only applies to you if you're running your own instance of GitHub Enterprise. GitHub.com is always the latest version of the GitHub application.
Debugging
To assist users of github-metadata-sync
with debugging the behavior of this module we use the debug utility package to print information about the publish process to the console. To enable debug message printing, the environment variable DEBUG
, which is the variable used by the debug
package, must be set to a value configured by the package containing the debug messages to be printed.
To print debug messages on a unix system set the environment variable DEBUG
with the name of this package prior to executing github-metadata-sync
:
DEBUG=github-metadata-sync github-metadata-sync
On the Windows command line you may do:
set DEBUG=github-metadata-sync
github-metadata-sync
Node Support Policy
We only support Long-Term Support versions of Node.
We specifically limit our support to LTS versions of Node, not because this package won't work on other versions, but because we have a limited amount of time, and supporting LTS offers the greatest return on that investment.
It's possible this package will work correctly on newer versions of Node. It may even be possible to use this package on older versions of Node, though that's more unlikely as we'll make every effort to take advantage of features available in the oldest LTS version we support.
As each Node LTS version reaches its end-of-life we will remove that version from the node
engines
property of our package's package.json
file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node. Any merge requests or issues supporting an end-of-life version of Node will be closed.
We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs against all LTS versions of Node in addition the most recent Node release; called current.
JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node
engines
property. If you encounter issues installing this package, please report the issue to your package manager.
Contributing
Please read our contributing guide on how you can help improve this project.