tonglil / labeler

Superseded by https://github.com/apps/settings - Manage labels on GitHub as code
MIT License
82 stars 11 forks source link
cli github github-api github-enterprise go golang labels maintainer-tools open-source repository-utilities tool

Superseded by http://github.com/apps/settings


Labeler Build Status

logo

Label management (create/rename/update/delete) on Github as code.

For FOSS maintainers, enable your users to submit PRs and improve the process/label system!

Inspired by infrastructure as code tools like Terraform and organized label systems in projects like these:

Installation

Get binaries for OS X / Linux / Windows from the latest release.

Or use go get:

go get -u github.com/tonglil/labeler

Usage

First, set a GitHub token in the environment (optional, the token can be set as an cli argument as well).

export GITHUB_TOKEN=xxx
  • The token for public repos need the public_repo scope.
  • The token for private repos need the repo scope.

Scanning labels

To scan existing labels from a repository and save it to a file:

labeler scan labels.yaml --repo owner/name

Which when run against a "new" repo created on GitHub, will:

And write them into labels.yaml, creating the file if it doesn't exist, otherwise overwriting its contents.

Applying labels

To apply labels to a repository:

labeler apply labels.yaml --dryrun

Where labels.yaml is like:

repo: owner/name
labels:
  - name: bug
    color: fc2929
  - name: help wanted
    color: 000000
  - name: fix
    color: cccccc
    from: wontfix
  - name: notes
    color: fbca04

Which when run against a "new" repo created on GitHub, will:

When run again, rename changes will not be run because the label already exists. In this manner, this tool is idempotent.

Usage options

$ labeler
Labeler is a CLI application for managing labels on Github as code.

With the ability to scan and apply label changes, repository maintainers can
empower contributors to submit PRs and improve the project management
process/label system!

Usage:
  labeler [command]

Available Commands:
  apply       Apply a YAML label definition file
  completion  Output shell completion code for tab completion
  scan        Save a repository's labels into a YAML definition file
  version     Print the version information

Use "labeler [command] --help" for more information about a command.

Tab completion

source <(labeler completion)

Development

glide is used to manage vendor dependencies.

Roadmap:

Testing

This could use your contribution! Help me create a runnable test suite.

See also