A short guide and template for GitHub issue labels
Basic notes and template for creating labels for GitHub issues using the gh command line tool.
Jump directly to the new label template.
- Introduction
- gh CLI label syntax
- gh label create command format
- Interlude: Color Selection
- Default Issue Labels
- New Issue Labels
- Cloning labels from another project
- Issue Label Examples
- gh aliases
- Other examples of gh label usage
- Resources
Introduction
This post is mostly about one command. Specifically, it's about one sub-command available with the gh CLI tool: gh label create
. It's not because I think that it's a particularly interesting or complicated command. It's mostly because I rarely use the command infrequently and I need a reference for the "standard" that I have casually set up for myself. I work with git
and gh
commands daily. Many have been successfully committed to muscle memory. With other lengthy gh
commands, I've turned a few of them into memorable aliases. I should probably make use of gh alias set; but, that's for another day.
As stated in GitHub's documentation on managing labels:
You can manage your work on GitHub by creating labels to categorize issues, pull requests, and discussions. You can apply labels in the repository the label was created in. Once a label exists, you can use the label on any issue, pull request, or discussion within that repository.
I only use the gh label create
command when I create a new repository. The time between creating a new project varies from anywhere between a couple of weeks and several months. So, naturally, I tend to forget commands that haven't entered my muscle memory. With my projects using Python web frameworks,
I've mostly standardized on my issue labels and can use the gh label clone
command for these projects.
The GitHub organizations feature could also help facilitate the management of default labels across repositories. I, personally, have no plans on using it for now; but, it may be of use for some.
gh CLI label syntax
From the gh CLI manual:
USAGE
- gh label
[flags]
- gh label
AVAILABLE COMMANDS
- clone: Clones labels from one repository to another
- create: Create a new label
- delete: Delete a label from a repository
- edit: Edit a label
- list: List labels in a repository
FLAGS
- -R, --repo [HOST/]OWNER/REPO Select another repository using the [HOST/]OWNER/REPO format
gh label create command format
gh label create <name> [flags]
gh label create <name> -d "description_string" -c "color_string"
Interlude: Color Selection
According to the gh manual, the label color needs to be specified as a six character hex value. Despite my working in desktop publishing and pre-press in a prior life, I don't have many hex color values memorized; so, I tend to rely on a color chart or a color picker application to help me in my color decisions. The availability of color charts and hex color codes on the internet is abundant. Plentiful even. There must be at least 10 color charts available online for reference. Here are two that I use frequently:
I'm also partial to using a locally installed color picker application. I've been using gcolor3
lately. It's simple and meets my basic needs. For alternatives, here is an OK list of other color picker applications available on Linux distros for installation:
Default Issue Labels
Label Name | Description | Color |
---|---|---|
bug | Something isn't working | #d73a4a |
documentation | Improvements/additions to documentation | #0075ca |
duplicate | This issue or pull request already exists | #cfd3d7 |
enhancement | New feature of request | #a2eeef |
help wanted | Extra attention is needed | #008672 |
good first issue | Good for newcomers | #7057ff |
invalid | This doesn't seem right | #e4e669 |
question | Further information is requested | #d876e3 |
wontfix | This will not be worked on | #ffffff |
New Issue Labels
Label Name | Description | Color |
---|---|---|
build system | Issues related to building and packaging | #f95f13 |
deployment | project release & publishing | #52794f |
performance | Issues related to application performance | #cb738a |
security | bug reports, fixes, vulnerability issues | #7057ff |
testing | project testing & validation | #5319e7 |
Cloning labels from another project
If there is a repository that has a set of labels that can be used as a template for a new project, one can clone all of its existing labels to the new project with the command:
gh label clone -f kevinbowen777/django-start
Issue Label Examples
If you want to be selective, the labels can be individually added as follows:
gh label create "build system" -c F95F13 -d "Issues related to building, packaging"
gh label create deployment -c 52794F -d "project release & publishing"
gh label create performance -c CB738A -d "Issues related to application performance"
gh label create security -c 7057ff -d "bug reports, fixes, vulnerability issues"
gh label create testing -c 5319e7 -d "project testing & validation"
Other examples of gh label usage
As you can see, my usage of issue labels is pretty simple. Here are a couple of examples of label usage in more complex projects:
gh aliases
Some frequently used gh
commands that I have converted to bash aliases:
alias ghicb='gh issue create --label bug --assignee @me'
alias ghicd='gh issue create --label documentation --assignee @me'
alias ghice='gh issue create --label enhancement --assignee @me'
alias ghict='gh issue create --label testing --assignee @me'
alias ghil='gh issue list --limit 100'
No comments:
Post a Comment