Python script to clone GitHub Issue Labels from one repository to another.
GitHub Labels are really useful for organising issues and pull requests, especially when you use them with GitHub Projects.
- Copies all labels from one repo to another
- Removes existing labels in target repo by default
- Supports
--keep-existingflag to preserve existing labels - Small benefit in the form of asynchronous operations
- Python 3.8+
httpx- A GitHub personal access token (obtained from GitHub Settings)
Install dependencies:
pip install -r requirements.txtpython copy_labels.py \
--token YOUR_GITHUB_TOKEN \
--source username/repo-from \
--target username/repo-toTo preserve existing labels in the target repo, use the --keep-existing flag:
python copy_labels.py \
--token YOUR_GITHUB_TOKEN \
--source username/repo-from \
--target username/repo-to \
--keep-existingYou can also provide environment variables instead of flags:
GITHUB_TOKENSOURCE_REPOTARGET_REPO
