| Crates.io | gh-labeler |
| lib.rs | gh-labeler |
| version | 0.1.8 |
| created_at | 2025-09-07 05:51:28.400524+00 |
| updated_at | 2025-09-15 04:38:19.202437+00 |
| description | A fast and reliable GitHub repository label management tool built with Rust |
| homepage | https://github.com/kkhys/gh-labeler |
| repository | https://github.com/kkhys/gh-labeler |
| max_upload_size | |
| id | 1827852 |
| size | 170,613 |
๐ฆ A fast and reliable GitHub repository label management tool built with Rust.
# Install globally
npm install -g gh-labeler
# Or run directly with npx
npx gh-labeler --help
cargo install gh-labeler
Download the latest binary from GitHub Releases.
repo scopegh-labeler init --format json > labels.json
gh-labeler sync -t YOUR_GITHUB_TOKEN -r owner/repo -c labels.json
# Sync with default labels
gh-labeler sync -t TOKEN -r owner/repo
# Preview changes (dry-run)
gh-labeler preview -t TOKEN -r owner/repo
# Generate default configuration
gh-labeler init --format json
# List current repository labels
gh-labeler list -t TOKEN -r owner/repo
Create a labels.json or labels.yaml file:
[
{
"name": "bug",
"color": "#d73a4a",
"description": "Something isn't working",
"aliases": ["defect", "issue"]
},
{
"name": "enhancement",
"color": "#a2eeef",
"description": "New feature or request",
"aliases": ["feature"]
},
{
"name": "documentation",
"color": "#0075ca",
"description": "Improvements or additions to documentation",
"aliases": ["docs"]
}
]
gh-labeler [COMMAND] [OPTIONS]
Commands:
sync Synchronize repository labels
preview Preview sync operations (dry-run)
init Generate default configuration
list List current repository labels
help Show help information
Options:
-t, --access-token <TOKEN> GitHub access token
-r, --repository <REPO> Repository (owner/repo format)
-c, --config <FILE> Configuration file path
--dry-run Preview mode (no changes)
--allow-added-labels Keep labels not in configuration
-v, --verbose Verbose output
-h, --help Show help information
# Set GitHub token via environment variable
export GITHUB_TOKEN=your_token_here
gh-labeler sync -r owner/repo
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | โ | Label name |
color |
string | โ | Hex color code (with # prefix required) |
description |
string | โ | Label description |
aliases |
array | โ | Alternative names for the label |
delete |
boolean | โ | Mark label for deletion |
- name: "priority: high"
color: "#ff0000"
description: "High priority issue"
aliases: ["urgent", "critical"]
- name: "type: feature"
color: "#00ff00"
description: "New feature request"
aliases: ["enhancement", "feature-request"]
- name: "status: wontfix"
color: "#cccccc"
description: "This will not be worked on"
delete: true # Mark for deletion
# Using JSON configuration
gh-labeler sync \\
--access-token ghp_xxxxxxxxxxxx \\
--repository myorg/myproject \\
--config my-labels.json
# Using YAML configuration
gh-labeler sync \\
--access-token ghp_xxxxxxxxxxxx \\
--repository myorg/myproject \\
--config labels.yaml
# See what changes would be made
gh-labeler preview -t $GITHUB_TOKEN -r owner/repo -c labels.json
# Verbose preview with detailed operations
gh-labeler preview -t $GITHUB_TOKEN -r owner/repo -c labels.json --verbose
# Keep labels that aren't in your configuration
gh-labeler sync \\
--access-token $GITHUB_TOKEN \\
--repository owner/repo \\
--config labels.json \\
--allow-added-labels
You can also use gh-labeler as a Rust library in your projects:
[dependencies]
gh-labeler = "0.1"
tokio = { version = "1.0", features = ["full"] }
use gh_labeler::{SyncConfig, LabelSyncer, LabelConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = SyncConfig {
access_token: "your_token".to_string(),
repository: "owner/repo".to_string(),
dry_run: false,
allow_added_labels: false,
labels: Some(vec![
LabelConfig::new("bug".to_string(), "d73a4a".to_string())?,
]),
};
let syncer = LabelSyncer::new(config).await?;
let result = syncer.sync_labels().await?;
println!("Sync completed! Created: {}, Updated: {}, Deleted: {}",
result.created, result.updated, result.deleted);
Ok(())
}
| Aspect | gh-labeler (Rust) |
|---|---|
| Performance | โกโกโก Lightning fast |
| Memory Usage | ๐๐๐ Minimal footprint |
| Binary Size | ๐ฆ Compact single binary |
| Startup Time | ๐ Instant startup |
| Cross-platform | โ Windows, macOS, Linux |
| Configuration | JSON + YAML support |
| Dry-run | โ Safe preview mode |
| Verbose output | Detailed operations |
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)# Clone the repository
git clone https://github.com/kkhys/gh-labeler.git
cd gh-labeler
# Build the project
cargo build
# Run tests
cargo test
# Install locally
cargo install --path .
# Test npm package locally
npm pack
npm install -g gh-labeler-0.1.0.tgz
This project is licensed under the MIT License - see the LICENSE.md file for details.