Skip to content

skaiwlkr/label-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Label Sync

A tool for easy management of labels in GitHub repositories. This repository contains scripts for creating and deleting labels with predefined categories for various project types.

🚀 Features

  • Creating Labels: Predefined labels for bugs, features, status and more
  • Easy Label Deletion: Targeted removal of unwanted labels
  • GitHub CLI Integration: Uses the official GitHub CLI for secure API calls
  • Color-coded Labels: Professional color scheme for better overview

📋 Prerequisites

  • GitHub CLI installed and configured
  • Bash shell (Linux, macOS, WSL)
  • Permission to manage labels in the target repository

GitHub CLI Installation

# macOS
brew install gh

# Ubuntu/Debian
sudo apt install gh

# Windows (with Chocolatey)
choco install gh

GitHub CLI Authentication

gh auth login

🛠️ Installation

  1. Clone the repository:
git clone https://github.com/yourusername/label-sync.git
cd label-sync
  1. Make scripts executable:
chmod +x create-labels.sh delete-labels.sh

📖 Usage

Creating Labels

Run the script in the desired repository:

./create-labels.sh

Note: Make sure you are in the correct repository directory or specify the repository as a parameter.

Creating Labels in Another Repository

You can also create labels in another repository without switching repositories:

# Format: OWNER/REPOSITORY
./create-labels.sh --repo username/repository-name

# Example:
./create-labels.sh --repo octocat/hello-world

Deleting Labels

To delete labels, first edit the delete-labels.sh file:

# Open the file in your editor
nano delete-labels.sh

Remove the comments before the labels you want to delete:

labels=(
  "🐞 Bug"  # Remove comment to delete
  # "🔁 Duplicate"  # Remains commented
)

Then run the delete script:

./delete-labels.sh

Deleting Labels in Another Repository

You can also delete labels in another repository:

# Format: OWNER/REPOSITORY
./delete-labels.sh --repo username/repository-name

# Example:
./delete-labels.sh --repo octocat/hello-world

🔧 Customization

Adding New Labels

Edit the create-labels.sh file and add new entries to the labels array:

labels=(
  # Existing labels...
  "🎨 Design,Design-related changes,ff6b6b"
)

Format: "Name,Description,Color"

Removing Labels

Comment out the corresponding lines in create-labels.sh or remove them completely.

🚨 Troubleshooting

"gh: command not found"

  • Make sure GitHub CLI is installed
  • Check your PATH

"Authentication required"

  • Run gh auth login
  • Check your repository permissions

"Label already exists"

  • This is normal - existing labels are skipped
  • Use delete-labels.sh to remove labels

"Permission denied"

  • Check your repository permissions
  • Make sure you have admin rights

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test the scripts
  5. Create a pull request

⚠️ Disclaimer

These scripts directly modify labels in your GitHub repository. Use them with caution and test them in a test repository before using them in production repositories.


Tip: You can also use these scripts in GitHub Actions to automatically manage labels!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages