Terminal-first GitHub label management - Simple, fast, no token needed.
Manage GitHub labels from your terminal using gh CLI. No manual token setup required.
# 1. Install gh CLI and authenticate (one-time setup)
brew install gh # macOS
gh auth login
# 2. Install labels-config
npm install -g @boxpistols/labels-config
# 3. Initialize from template
labels-config init minimal --file labels.json
# 4. Sync to your repository
labels-config sync --owner your-name --repo your-repo --file labels.jsonDone! Your labels are synced.
- Terminal-First: No token management - uses gh CLI authentication
- Simple CLI: 5 commands, straightforward usage
- Pre-built Templates: 9 ready-to-use label sets
- Validation: Check your config before syncing
- Dry Run: Preview changes before applying
Install and authenticate gh CLI:
# macOS
brew install gh
# Linux (Debian/Ubuntu)
sudo apt install gh
# Windows
winget install --id GitHub.cli
# Authenticate
gh auth loginnpm install -g @boxpistols/labels-configImportant: The init command creates a local configuration file - it does NOT sync to GitHub.
| Command | What it does |
|---|---|
init |
Creates labels.json locally (no GitHub changes) |
sync |
Applies labels.json to your GitHub repository |
Example workflow:
# Step 1: Create local config file (no GitHub changes yet)
labels-config init prod-ja --file labels.json
# Step 2: Check what's in the file
cat labels.json
# Step 3: Apply to GitHub (this actually changes your labels)
labels-config sync --owner your-name --repo your-repo --file labels.jsonFrom template:
labels-config init minimal --file labels.jsonAvailable templates:
minimal- Basic 3-label set (bug, feature, documentation)github- GitHub standard labelsprod-ja- Production project (Japanese, 14 labels)prod-en- Production project (English, 14 labels)agile- Agile/Scrum workflowreact,vue,frontend- Framework-specific
labels-config validate labels.jsonlabels-config sync \
--owner your-name \
--repo your-repo \
--file labels.json \
--dry-run \
--verboseAppend mode (default - keeps existing labels):
labels-config sync --owner your-name --repo your-repo --file labels.jsonReplace mode (removes unlisted labels):
labels-config sync --owner your-name --repo your-repo --file labels.json --delete-extralabels-config export --owner your-name --repo your-repo --file exported.json| Command | Description |
|---|---|
init <template> |
Create label config from template |
validate <file> |
Validate label configuration |
sync |
Sync labels to GitHub |
export |
Export labels from GitHub |
help |
Show help |
| Option | Description |
|---|---|
--owner <name> |
Repository owner |
--repo <name> |
Repository name |
--file <path> |
Config file path |
--dry-run |
Preview changes only |
--delete-extra |
Delete unlisted labels (replace mode) |
--verbose |
Show detailed output |
{
"version": "1.0.0",
"labels": [
{
"name": "bug",
"color": "d73a4a",
"description": "Something isn't working"
},
{
"name": "feature",
"color": "0e8a16",
"description": "New feature request"
}
]
}Requirements:
name: 1-50 characterscolor: 3 or 6 character hex code (without #)description: 1-200 characters
Adds new labels and updates existing ones. Keeps labels not in your config.
labels-config sync --owner user --repo repo --file labels.jsonDeletes all labels not in your config. Complete control.
labels-config sync --owner user --repo repo --file labels.json --delete-extra--dry-run first!
Sync the same labels to multiple repositories:
#!/bin/bash
REPOS=("org/repo1" "org/repo2" "org/repo3")
for REPO in "${REPOS[@]}"; do
OWNER=$(echo $REPO | cut -d'/' -f1)
REPO_NAME=$(echo $REPO | cut -d'/' -f2)
labels-config sync \
--owner $OWNER \
--repo $REPO_NAME \
--file labels.json \
--verbose
donename: Sync Labels
on:
push:
paths:
- 'labels.json'
branches:
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install labels-config
run: npm install -g @boxpistols/labels-config
- name: Install gh CLI
run: |
sudo apt update
sudo apt install gh -y
- name: Authenticate gh CLI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "$GITHUB_TOKEN" | gh auth login --with-token
- name: Sync labels
run: |
labels-config sync \
--owner ${{ github.repository_owner }} \
--repo ${{ github.event.repository.name }} \
--file labels.json \
--verboseThis package uses npm Trusted Publishers (OIDC) for secure, automated publishing. No long-lived tokens required!
Key Features:
- β Zero token management - GitHub Actions authenticates automatically
- β Enhanced security - No risk of token leakage
- β Automatic provenance - Package authenticity verification
- β Auto-release on merge - Patch version published when merging to main
Automatic Release (main branch):
# When you merge to main, the system automatically:
# 1. Bumps the patch version (e.g., 0.2.0 β 0.2.1)
# 2. Builds the package
# 3. Publishes to npm with provenance
# 4. Pushes the version tagManual Release: Use GitHub Actions UI to trigger manual releases with custom version bumps:
- Navigate to Actions β Manual Release
- Choose version type:
patch/minor/major/prerelease - Run the workflow
Skip Auto-Release:
Include [skip ci] or [no release] in your commit message:
git commit -m "docs: update README [skip ci]"For maintainers: OIDC publishing requires one-time setup in npm. See the detailed guide:
π Complete OIDC Setup Guide (in Japanese)
Note: npm Trusted Publisher setup must be done via npmjs.com Web UI. CLI/terminal configuration is not currently supported by npm.
The following npm scripts have been removed (now automated via GitHub Actions):
# π« No longer available
npm run release:patch
npm run release:minor
npm run release:major
npm run release:betaAll releases are now handled automatically through GitHub Actions workflows.
# Check gh CLI status
gh auth status
# Re-authenticate
gh auth login
# Refresh authentication
gh auth refresh# Run validation to see specific errors
labels-config validate labels.json
# Common issues:
# - Duplicate label names
# - Invalid hex colors (must be 3 or 6 chars without #)
# - Name too long (max 50 chars)
# - Description too long (max 200 chars)# Check with verbose output
labels-config sync --owner user --repo repo --file labels.json --verbose
# Try dry run to see what would change
labels-config sync --owner user --repo repo --file labels.json --dry-run --verbose# Check rate limit status
gh api rate_limit
# Wait for reset (typically 60 minutes)β DO:
- Keep
labels.jsonin version control - Run
--dry-runbefore actual sync - Use semantic commit messages
- Document label purposes in your project
- Use consistent colors across projects
β DON'T:
- Delete labels without checking issue/PR usage
- Change label names frequently
- Skip validation before syncing
You can also use this as a library in your code:
import { GitHubLabelSync } from '@boxpistols/labels-config/github'
import { CONFIG_TEMPLATES } from '@boxpistols/labels-config'
const sync = new GitHubLabelSync({
owner: 'your-org',
repo: 'your-repo'
})
const labels = CONFIG_TEMPLATES.minimal
await sync.syncLabels(labels)Install in your project:
npm install @boxpistols/labels-configMIT
Made for terminal users who love gh CLI π