@cogniwave/gh-sync v1.1.3
gh-sync
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.
Setup
Installation
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-syncDirect Execution with npx (or other runners)
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-syncToken
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
Usage
Once you have your GitHub token, you can use the tool to sync labels between repositories.
Command Syntax
@cogniwave/gh-sync <origin> <target> [options]Arguments
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}
Options
--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
Example Usage
To synchronize labels from
repo-atorepo-b:@cogniwave/gh-sync owner/repo-a owner/repo-b --token your_github_tokenTo synchronize labels from
repo-atorepo-bwith implicit token:export $GITHUB_TOKEN = your_github_token @cogniwave/gh-sync owner/repo-a owner/repo-bTo synchronize labels from
repo-atorepo-bbut different tokens:@cogniwave/gh-sync owner/repo-a owner/repo-b --token-origin repo-a_token --token-destination repo-b_tokenTo run the tool in verbose mode:
@cogniwave/gh-sync owner/repo-a owner/repo-b --verbose
Development
bun installTo run:
bun dev