GitHub Action
Label Sync Action
Label Sync Action is a simple action that syncs labels to a GitHub repository or list of repositories.
Manage all tags from all your repositories in a single place.
The default file path is .github/labels.yml
, but you can specify a different path
see options below.
How to create a config file:
- Create a JSON or YAML file, with one of these extensions:
.json
,.jsonc
,.yaml
,.yml
. - Every label should be an array element: add some square brackets
[]
if you need to. - Every element of the array should be an object with the following properties:
name
- The name of the label.color
- The color of the label.description
- [optional] The description of the label.aliases
- [optional] An array containing the "aliases" of the label. If an existing label's name is an alias that label will be edited to match your config: this way you don't loose issues and PRs that have been labeled previously.
- name: breaking-change π₯
color: '#D93F0B'
description:
A change that changes the API or breaks backward compatibility for
users.
aliases: [breaking]
- name: bug π
color: d73a4a
description:
Inconsistencies or issues which will cause a problem for users or implementors.
- name: documentation π
color: 0075ca
description: Solely about the documentation of the project.
The
#
incolor
is optional.
[
// Support comments
{
// My label
"name": "breaking-change π₯",
"color": "#D93F0B",
"description":
"A change that changes the API or breaks backward compatibility for users.",
"aliases": [
"breaking"
]
},
{
"name": "bug π",
"color": "d73a4a",
"description":
"Inconsistencies or issues which will cause a problem for users or implementors."
},
{
"name": "documentation π",
"color": "0075ca",
"description": "Solely about the documentation of the project."
}
]
The
#
incolor
is optional.
Sample basic workflow:
name: β»οΈ Sync Labels
on:
workflow_dispatch:
jobs:
labels:
name: β»οΈ Sync labels
runs-on: ubuntu-22.04
steps:
- name: β€΅οΈ Check out code from GitHub
uses: actions/checkout@v3
- name: π Run Label Sync
uses: srealmoreno/label-sync-action@v2
Specify a repository or a list of repositories
...
- name: π Run Label Sync
uses: srealmoreno/label-sync-action@v2
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# Optional:
repositories: |
owner/repository-1
owner/repository-2
# Optional:
config-file: |
.github/labels-1.yml
.github/labels-2.yml
https://raw.githubusercontent.com/srealmoreno/label-sync-action/main/.github/labels/labels.yml
# Optional:
# Clean other labels not defined in the config file(s)
clean-labels: false
Note: The default
GITHUB_TOKEN
will not have permissions to write labels on other repositories so you must specify a Personal Access Token with access to repositories.
It's possible to get the labels of url.
If you use only url, the actions/checkout@v3
step is not necessary
...
steps:
- name: π Run Label Sync
uses: srealmoreno/label-sync-action@v2
with:
config-file: https://raw.githubusercontent.com/srealmoreno/label-sync-action/main/.github/labels/labels.yml
If you have a very large list of repositories and you want to have the same
tags in all repositories you can use the auto-discover-repos
option.
...
- name: π Run Label Sync
uses: srealmoreno/label-sync-action@v2
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
auto-discover-repos: true
# Optional:
exclude-repos: repo-1
# You can specify a array of the repositories to be excluded
exclude-repos: |
repository-1
repository-2
# You can specify regex to exclude repositories
exclude-repos: /^repository-1$/u
# Optional:
account-type: org | user
# Optional:
owner: owner
# Optional:
exclude-forked-repos: true
# Optional:
exclude-archived-repos: true
# Optional:
exclude-private-repos: true
# Optional:
exclude-disabled-repos: true
Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.
You can find more information about this project on the wiki.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Srealmoreno - Initial work - srealmoreno
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details
- Inspiration EndBug/label-sync
- Templates Z-shell