โญ๏ธ sync labels between repos and org. โญ๏ธ
English โข
ไธญๆ
๐งฉ Awesome features
This document discusses the development of a Go language actions that synchronizes labels on GitHub repositories. This actions is not limited to synchronizing labels on your own repository, but can also retrieve all of the API objects of a target repository, which can then be saved to a YAML file or synchronized to your own GitHub project.
Labels are an important way of organizing and categorizing issues and pull requests on GitHub. They allow you to quickly and easily identify the status, priority, and type of each issue or pull request.
To retrieve the API objects of a GitHub project's labels, you can use the following URLs:
- To retrieve the first page of objects:
https://api.github.com/repos/<owner>/<repo>/labels?page=1&sort=name-asc
- To retrieve all objects:
https://api.github.com/repos/<owner>/<repo>/labels?per_page=100&page=1&sort=name-asc
Simply replace <owner>
and <repo>
with the owner and repository name, respectively. These URLs can be used to retrieve all of the labels associated with a project, which can then be synchronized or saved as needed.
github-label-syncer is a tool to sync labels between repos and org. The main features are:
- Feel free to pick a remote repository and fetch all its labels to a local
yaml
, table
AND json
- Feel free to pick a remote repository and sync all of its labels to your desired project repository
- Sync labels across repositories according to configuration
- Create, update and delete labels
- Dry run to preview which labels would be created, updated or deleted
- Handle label collisions by renaming or skipping existing labels
- Support labeling pull requests and issues
Labels denger:
The labels are designed semantic and standard. We provide labels for priority, type, status etc. You can refer to the label doc to get more info.
**github actions
๐ซ Quick start
Note: You can get started quickly with github-label-syncer.
Work with Makefile
โฏ make help # show help
โฏ make build # build binary exporter and syncer
โฏ echo 'export PATH=$PATH:/path/to/_output/platforms/linux/amd64/' | tee -a ~/.zshrc;source ~/.zshrc
Work with actions
Actions provide handling of PR and issue.
We used the bot ๐@kubbot, It can detect issues in Chinese and translate them to English, and you can interact with it using the command /comment
.
Comment in an issue:
โฏ /intive
Use Github-Label-Syncer
You can set your own GITHUB_TOKEN
via env or via the export GITHUB_TOKEN
environment variable, or use one of the default tokens we provide, which is TOEKN
for our free automated ๐ค robot
โฏ ./_output/bin/platforms/linux/amd64/exporter --help
usage: exporter [<flags>] <owner> <repo>
Flags:
--[no-]help Show context-sensitive help (also try --help-long and --help-man).
-y, --[no-]yaml Use the YAML format.
-j, --[no-]json Use the JSON format.
-t, --[no-]table Use the table format.
-x, --[no-]xml Use the XML format.
--[no-]toml Use the TOML format.
--[no-]ini Use the INI format.
--[no-]csv Use the CSV format.
-f, --file=FILE Export labels to file.
--token=TOKEN GitHub token. ($GITHUB_TOKEN)
Args:
<owner> Owner of the repository.
<repo> Repository whose wanted labels.
โฏ export GITHUB_TOKEN="ghp_****************************************0z"
โฏ exporter kubecub log --json | jq
[
{
"name": "major version",
"description": "Automatically create a new major version tag after PR is merged",
"color": "1E8DE7"
},
{
"name": "merge when passing",
"description": "Merge the PR automatically once all status checks have passed",
"color": "FF851B"
},
{
"name": "minor version",
"description": "Automatically create a new minor version tag after PR is merged",
"color": "6EBAF7"
},
{
"name": "patch version",
"description": "Automatically create a new patch version tag after PR is merged",
"color": "99cef9"
}
]
โฏ ./_output/bin/platforms/linux/amd64/exporter kubernetes kubernetes --yaml -f ./_output/tmp/kubernetes_labels.yaml
โฏ tree _output/
_output/
โโโ bin
โ โโโ platforms
โ โโโ linux
โ โโโ amd64
โ โโโ exporter
โ โโโ syncer
โโโ tmp
โ โโโ kubernetes_labels.yaml
โโโ tools
โโโ addlicense
โโโ go-gitlint
โฏ ./syncer --help
Work with Docker
โฏ make deploy
๐ architecture diagram
graph LR
A[Config file] -->B(github-label-syncer)
B --> C{Sync labels}
C -->|Yes| D[Create/Update labels]
C -->|No | E[Delete labels]
D --> F[Dry run]
F --> |Yes| G[Preview]
F --> |No| H[Apply changes]
E --> I[Dry run]
I --> |Yes| J[Preview]
I --> |No| K[Apply changes]
MVC Architecture Design:
flowchart TB
A[Config file]
A --> B[github-label-syncer]
B --> C{Sync labels}
C -->|Yes|D[<font color='green'>Create/Update </font> <br>labels]
C -->|No|E[<font color='red'>Delete </font><br> labels]
D -.-> F[<font color='blue'>Dry run</font><br>Preview]
F --> G[Apply <br>changes]
E -.-> H[<font color='blue'>Dry run</font><br>Preview]
H --> I[Apply<br> changes]
B --> J[Label <br>PRs & <br>Issues]
๐ค File Directory Description
Catalog standardization design structure:
.github-label-syncer
โโโ CONTRIBUTING.md # Contribution guidelines
โโโ LICENSE # License information
โโโ Makefile # Makefile for building and running the project
โโโ README.md # Project overview in English
โโโ README_zh-CN.md # Project overview in Chinese
โโโ api # API-related files
โ โโโ OWNERS # API owners
โ โโโ README.md # API documentation
โโโ assets # Static assets, such as images and stylesheets
โ โโโ README.md # Assets documentation
โโโ build # Build-related files
โ โโโ OWNERS # Build owners
โ โโโ README.md # Build documentation
โโโ cmd # Command-line tools and entry points
โ โโโ OWNERS # Command owners
โ โโโ README.md # Command documentation
โโโ configs # Configuration files
โ โโโ OWNERS # Configuration owners
โ โโโ README.md # Configuration documentation
โ โโโ config.yaml # Main configuration file
โโโ deploy # Deployment-related files
โ โโโ OWNERS # Deployment owners
โ โโโ README.md # Deployment documentation
โโโ docs # Project documentation
โ โโโ OWNERS # Documentation owners
โ โโโ README.md # Documentation index
โโโ examples # Example code and usage
โ โโโ OWNERS # Example owners
โ โโโ README.md # Example documentation
โโโ init # Initialization files
โ โโโ OWNERS # Initialization owners
โ โโโ README.md # Initialization documentation
โโโ internal # Internal application code
โ โโโ OWNERS # Internal code owners
โ โโโ README.md # Internal code documentation
โ โโโ app # Application logic
โ โโโ pkg # Internal packages
โ โโโ utils # Utility functions and helpers
โโโ pkg # Public packages and libraries
โ โโโ OWNERS # Package owners
โ โโโ README.md # Package documentation
โ โโโ common # Common utilities and helpers
โ โโโ log # Log utilities
โ โโโ tools # Tooling and scripts
โ โโโ utils # General utility functions
โ โโโ version # Version information
โโโ scripts # Scripts for development and automation
โ โโโ LICENSE_TEMPLATES # License templates
โ โโโ OWNERS # Script owners
โ โโโ README.md # Script documentation
โ โโโ githooks # Git hooks for development
โ โโโ make-rules # Makefile rules and scripts
โโโ test # Test files and test-related utilities
โ โโโ OWNERS # Test owners
โ โโโ README.md # Test documentation
โโโ third_party # Third-party dependencies and libraries
โ โโโ README.md # Third-party documentation
โโโ tools # Tooling and utilities for development
โ โโโ README.md # Tool documentation
โโโ web # Web-related files, such as HTML and CSS
โโโ OWNERS # Web owners
โโโ README.md # Web documentation
We welcome everyone to join us and contribute to github-label-syncer, whether you are new to open source or professional. We are committed to promoting an open source culture, so we offer community members neighborhood prizes and reward money in recognition of their contributions. We believe that by working together, we can build a strong community and make valuable open source tools and resources available to more people. So if you are interested in github-label-syncer, please join our community and start contributing your ideas and skills!
We take notes of each biweekly meeting in GitHub discussions, and our minutes are written in Google Docs.
github-label-syncer maintains a public roadmap. It gives a a high-level view of the main priorities for the project, the maturity of different features and projects, and how to influence the project direction.
๐คผโ Contributing & Development
kubecub Our goal is to build a top-level open source community. We have a set of standards, in the Community repository.
If you'd like to contribute to this github-label-syncer repository, please read our contributor documentation.
Before you start, please make sure your changes are in demand. The best for that is to create a new discussion OR Slack Communication, or if you find an issue, report it first.
๐จ License
Kubecub is licensed under the MIT License, Version 2.0. See LICENSE for the full license text.

๐ฎ Thanks to our contributors!