This tool allows you to synchronize labels between two GitHub repositories. It retrieves the labels from a source repository and updates the labels in the target repository.
It requires a GitHub access token with the necessary permissions to manage labels on GitHub repositories.
Install it globally or locally with whatever package manager you use
npm install -g @cogniwave/gh-sync
pnpm add -g @cogniwave/gh-sync
yarn global add @cogniwave/gh-sync
bun add @cogniwave/gh-sync
If you prefer not to install the tool globally, you can run it directly using:
npx @cogniwave/gh-sync
bunx @cogniwave/gh-sync
yarn dlx @cogniwave/gh-sync
pnpm @cogniwave/gh-sync
Before using the tool, you need to create a GitHub access token with the following required permissions:
- issues:read and write: Used to get labels and create new ones
- pull requests:read and write: Used to delete tokens in destination repository if you wish
Once you have your GitHub token, you can use the tool to sync labels between repositories.
@cogniwave/gh-sync <origin> <target> [options]
origin <string>
: The repository from which you want to copy labels in the format of{owner}/{repository}
target <string>
: The repository where you want to update the labels in the format of{owner}/{repository}
--verbose
: Runs the tool in verbose mode, providing detailed logs about the operations being performed.-t, --token <string>
: Auth token to allow gh-sync to do it's thing. Use this if the token is the same for both origin and destination repositories"--token-origin
: Auth token of the origin repository, to allow gh-sync to do it's thing--token-destination
: Auth token of the destination repository, to allow gh-sync to do it's thing
-
To synchronize labels from
repo-a
torepo-b
:@cogniwave/gh-sync owner/repo-a owner/repo-b --token your_github_token
-
To synchronize labels from
repo-a
torepo-b
with implicit token:export $GITHUB_TOKEN = your_github_token @cogniwave/gh-sync owner/repo-a owner/repo-b
-
To synchronize labels from
repo-a
torepo-b
but different tokens:@cogniwave/gh-sync owner/repo-a owner/repo-b --token-origin repo-a_token --token-destination repo-b_token
-
To run the tool in verbose mode:
@cogniwave/gh-sync owner/repo-a owner/repo-b --verbose
bun install
To run:
bun dev