A simple 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.
This script helps you set up new repositories with a ready-made label structure copied from your ideal project.
- Copies all labels from one repo to another
- Removes existing labels in target repo by default
- Supports
--keep-existing
flag to preserve existing labels - Fast and parallel (async, based on
httpx
) - Uses GitHub API via a personal token
- Python 3.8+
httpx
- A GitHub personal access token (obtained from GitHub Settings)
Install dependencies:
pip install -r requirements.txt
python copy_labels.py \
--token YOUR_GITHUB_TOKEN \
--source username/repo-from \
--target username/repo-to
To 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-existing
You can also provide environment variables instead of flags:
GITHUB_TOKEN
SOURCE_REPO
TARGET_REPO
This project is licensed under the MIT Licence.