-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
131 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
github-labeler | ||
============== | ||
Labels as a Code! | ||
================= | ||
|
||
CLI that sets GitHub labels exactly as written in YAML file | ||
|
||
## Usage | ||
![](demo.png) | ||
|
||
```console | ||
$ go build | ||
$ ./github-labeler | ||
``` | ||
CLI that sets GitHub labels exactly as written in YAML file | ||
|
||
## What this app does | ||
## Concepts | ||
|
||
- Create a label (e.g. when no label described in YAML) | ||
- Edit a label (e.g. when its color was changed) | ||
|
@@ -34,10 +29,133 @@ repos: | |
- kind/reactive | ||
``` | ||
## Author | ||
## Run as GitHub Actions | ||
### YAML for defined labels | ||
You can put this file to anywhere as you like. It defaults to `.github/labels.yml`. This is the config file to define the labels. Basically it means GitHub labels are configured as this file defines. | ||
|
||
<details><summary><code>.github/labels.yml</code></summary> | ||
</br> | ||
|
||
```yaml | ||
labels: | ||
- name: help wanted | ||
description: Extra attention is needed | ||
color: "008672" | ||
- name: bug | ||
description: Something isn't working | ||
color: fc2929 | ||
- name: enhancement | ||
description: New feature or request | ||
color: 84b6eb | ||
- name: question | ||
description: Further information is requested | ||
color: cc317c | ||
repos: | ||
- name: user/repo | ||
labels: | ||
- help wanted | ||
- bug | ||
- enhancement | ||
- question | ||
``` | ||
|
||
</details> | ||
|
||
### YAML for workflows to sync labels between existing one and defined one | ||
|
||
This is the one of the workflow of this app. | ||
It means to do the same with GitHub Actions as running github-labeler on your local machine. | ||
|
||
<details><summary><code>.github/workflows/sync_labels.yml</code></summary> | ||
</br> | ||
|
||
![](ga-sync.png) | ||
|
||
```yaml | ||
name: Sync labels | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- .github/labels.yml | ||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Sync labels | ||
uses: b4b4r07/github-labeler@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
|
||
</details> | ||
|
||
### YAML for workflows to import labels from existing one to defined one | ||
|
||
This is the workflow to import your existing labels on GitHu to the definition YAML. | ||
Even if you define the labels on YAML file, someone may change the label information or create new one on GitHub (Web UI). If so, these labels updating should be synced with the definition file. In order to solve those problems, this workflow imports label-related changes triggered by events of labels activities. | ||
|
||
<details><summary><code>.github/workflows/import_labels.yml</code></summary> | ||
</br> | ||
|
||
```yaml | ||
name: Import labels | ||
on: | ||
label: | ||
types: | ||
- created | ||
- edited | ||
- deleted | ||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Import between existing labels | ||
uses: b4b4r07/github-labeler@master | ||
with: | ||
import: 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "Import existing labels" | ||
title: "Import existing labels" | ||
body: | | ||
## WHAT | ||
This pull request was created by [create-pull-request](https://github.com/peter-evans/create-pull-request). | ||
## WHY | ||
Current labels.yaml and existing labels don't match. | ||
branch: import-labels | ||
branch-suffix: timestamp | ||
``` | ||
|
||
</details> | ||
|
||
@b4b4r07 | ||
<img src="ga-import.png" width="400"> | ||
|
||
## Installation | ||
|
||
Download the binary from [GitHub Releases][release] and drop it in your `$PATH`. | ||
|
||
- [Darwin / Mac][release] | ||
- [Linux][release] | ||
|
||
## License | ||
|
||
MIT | ||
[MIT][license] | ||
|
||
[release]: https://github.com/b4b4r07/github-labeler/releases/latest | ||
[license]: https://b4b4r07.mit-license.org |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.