https://github.com/stephanakkerman/github-label-copier
Copy your issue labels from any (public) repository to another
https://github.com/stephanakkerman/github-label-copier
github github-api github-workflows issue issue-label issue-labels issues labeling labeling-tool labels python python3 workflow
Last synced: 7 months ago
JSON representation
Copy your issue labels from any (public) repository to another
- Host: GitHub
- URL: https://github.com/stephanakkerman/github-label-copier
- Owner: StephanAkkerman
- License: mit
- Created: 2022-02-04T17:07:36.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T16:15:38.000Z (over 1 year ago)
- Last Synced: 2025-01-24T14:17:13.616Z (9 months ago)
- Topics: github, github-api, github-workflows, issue, issue-label, issue-labels, issues, labeling, labeling-tool, labels, python, python3, workflow
- Language: Python
- Homepage:
- Size: 17.4 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Label Copier
[](https://www.python.org/downloads/release/python-380/)
[](https://github.com/psf/black)
[](https://opensource.org/licenses/MIT)This repository contains two simple tools to match easily match your labels with your other GitHub repositories.
## GitHub Workflow
There are two options for copying over the labels from another repository. The first is to keep the labels that are already in the repository and only add the labels that are not in the repository yet. The second option is to delete all the labels in the repository and then add the labels from the other repository.
For both options, you need to give the workflow write access to the repository. You can find these settings in the repository settings under the `Actions` tab. Or fill in this URL: `https://github.com/[GITHUB-USERNAME]/[GITHUB-REPO]/settings/actions`, replace `[GITHUB-USERNAME]` with your GitHub username and `[GITHUB-REPO]` with the repository name.
In the yml file, you need to fill in the following `const sourceRepo = 'GITHUB-USER/GITHUB-REPO';`, replace `GITHUB-USER` with the username of the repository you want to copy the labels from and `GITHUB-REPO` with the repository name.
### Option 1: Keep Labels
This option will keep all the labels that are already in the repository and only add the labels that are not in the repository yet. This is useful if you want to keep the labels that you have already created in the repository.
You can find the .yml file for this workflow in the following location `workflows/keep-labels.yml`. Simply copy the contents of this file to your `.github/workflows` folder in your repository.
### Option 2: Delete Labels
This option will delete all the labels in the repository and then add the labels from the other repository. This is useful if you want to have the same labels in all your repositories.
You can find the .yml file for this workflow in the following location `workflows/delete-labels.yml`. Simply copy the contents of this file to your `.github/workflows` folder in your repository.
## Python Script
### Setup
There are 3 thing that you need to know before running this script, those things are:
- Your GitHub token that allows the script to make changes to your repo ([Tutorial](https://catalyst.zoho.com/help/tutorials/githubbot/generate-access-token.html))
- The repo that you want to copy the labels from (this can be any public repo)
- Your repo that you want to copy the labels toIf you have Python installed then fill those 3 things in in `src/config.py` and then you are ready to run:
```bash
python src/main.py
```### .exe File
If you do not have Python installed, do not worry, I have compiled a .exe file. The file is the interactive version of this script, if you want to look at the source code then check `src/label_copier.py`.
However, if you are afraid of running .exe files, you can build it yourself using the pyinstaller module. The instructions to do so are posted below.```bash
pip install pyinstaller
pyinstaller --onefile src/label_copier.py
```The .exe file will be created in the following location `src/dist/label_copier.exe`.
### Dependencies
There are no dependencies, the only library this script uses is the default request library for Python.
### How to run
- Clone the repository.
- Get your GitHub token.
- Run `python src/main.py` or `label_copier.exe`.
- See results.