|
| 1 | +# GitHub Labels Manager (GLM) |
| 2 | + |
| 3 | +*Enjoy your day and let automation do it for you. :)* |
| 4 | + |
| 5 | +<img alt="Banner" src="https://svg-banners.vercel.app/api?type=rainbow&text1=GitHub%20Labels%20Manager&width=800&height=400" style="text-align: center;"> |
| 6 | + |
| 7 | +[中文](https://github.com/DuckDuckStudio/GitHub-Labels-Manager/blob/main/README.md) | [English](https://github.com/DuckDuckStudio/GitHub-Labels-Manager/blob/main/other-languages/en_US/README.md) |
| 8 | + |
| 9 | +## Project profile |
| 10 | +GLM provides the following functions: |
| 11 | +- [x] Gets all the labels for a repository, stored in `labels.json` of the specified directory |
| 12 | +- [x] Empty the label of a repository *(token with repo permission required)* |
| 13 | +- [x] Set the label of a repository according to the specified **json** file *(empty the specified repository's labels before setting, requires a token with repo permission)* |
| 14 | +- [x] Copy the label of one repository to another repository *(empty the specified repository's labels before setting, requires a token with repo permission)* |
| 15 | + |
| 16 | +### About icon |
| 17 | +The current icon is for temporary use only and will be replaced if there is a formal design. |
| 18 | + |
| 19 | +> [!TIP] |
| 20 | +> If you would like to design a new icon, you can send your design to <[email protected]>. Thank you for supporting this project! |
| 21 | +
|
| 22 | +## Before use |
| 23 | +### Python |
| 24 | +Make sure you have the Python environment on your device. |
| 25 | +Run the following command to check the Python version: |
| 26 | + |
| 27 | +```bash |
| 28 | +python --version |
| 29 | +``` |
| 30 | + |
| 31 | +You might see output like this: |
| 32 | + |
| 33 | +``` |
| 34 | +C:\Users\user_name>python --version |
| 35 | +Python 3.12.0 |
| 36 | +``` |
| 37 | + |
| 38 | +#### Install Required Libraries |
| 39 | +After cd into the project directory, run the following command: |
| 40 | +```powershell |
| 41 | +# Create a virtual environment |
| 42 | +python -m venv .venv |
| 43 | +# Activate the virtual environment |
| 44 | +.venv\Scripts\Activate.ps1 |
| 45 | +# Install required libraries |
| 46 | +pip install -r requirements.txt |
| 47 | +``` |
| 48 | + |
| 49 | +> [!TIP] |
| 50 | +> Programs obtained using winget do not need to set this. |
| 51 | +
|
| 52 | +### Token |
| 53 | +You need a GitHub Token to run some of the features. |
| 54 | + |
| 55 | +> [!TIP] |
| 56 | +> Official document → [Managing your personal access tokens - GitHub Docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#%E5%88%9B%E5%BB%BA-personal-access-token-classic) |
| 57 | +
|
| 58 | +Follow these steps to get a GitHub Token: |
| 59 | + |
| 60 | +1. Sign in to GitHub: |
| 61 | + Open GitHub and sign in to your account. |
| 62 | + |
| 63 | +2. Navigate to Settings: |
| 64 | + Click on your profile icon in the top right corner, then select "**Settings**". |
| 65 | + |
| 66 | +3. Go to Token settings: |
| 67 | + In the left sidebar, click on "**Developer settings**". |
| 68 | + Then in the left sidebar again, locate and expand "**Personal access tokens**". |
| 69 | + Select "**Tokens (classic)**" under "**Personal access tokens**". |
| 70 | + |
| 71 | +4. Generate a new Token: |
| 72 | + Click on "**Generate new token**" in the upper right corner. |
| 73 | + Choose "**Generate new token (classic)**". |
| 74 | + |
| 75 | +5. Fill in Token details: |
| 76 | + Fill in the form as follows: |
| 77 | + Note → Name your token. |
| 78 | + Expiration → Choose "No expiration" if you want the token to never expire. |
| 79 | + Select scopes → Select **repo** for the token's scope. |
| 80 | + |
| 81 | +6. Generate the Token: |
| 82 | + Click the green button at the bottom ("Generate token"). |
| 83 | + |
| 84 | +7. Copy the generated Token: |
| 85 | + *Note: You won't be able to see this Token again, so make sure to store it securely and do not upload it to public repositories.* |
| 86 | + |
| 87 | +8. Insert the Token into your configuration file: |
| 88 | + Paste your Token into the `token` field in the `config.json`. |
| 89 | + Or run `glm config --token <YOUR-TOKEN>` |
| 90 | + |
| 91 | +## How to get the program |
| 92 | +Please [go to the Releases page](https://github.com/DuckDuckStudio/GitHub-Labels-Manager/releases). |
| 93 | + |
| 94 | +### Using winget |
| 95 | +Run the following command: |
| 96 | +```powershell |
| 97 | +winget install DuckStudio.GitHubLabelsManager |
| 98 | +``` |
| 99 | + |
| 100 | +> [!TIP] |
| 101 | +> If the supported version number is *n*, $1.1 \leqslant n \leqslant 1.2$ |
| 102 | +
|
| 103 | +## How to use |
| 104 | +Run the following command for help: |
| 105 | +```powershell |
| 106 | +glm --help # winget or packaged program |
| 107 | +python glm.py --help # source code |
| 108 | +``` |
| 109 | +Get help for subcommands: |
| 110 | +```powershell |
| 111 | +glm <command> --help # winget or packaged program |
| 112 | +python glm.py <command> --help # source code |
| 113 | +``` |
0 commit comments