Skip to content

Keeps your labels in sync in a GitHub repo(s) from a config file. Manage all tags from all your repositories in a single place.

License

Notifications You must be signed in to change notification settings

srealmoreno/label-sync-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

49 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Label Sync Action Codacy Badge

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.

πŸš€ Getting Started

Create a config file πŸ“

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 # in color 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 # in color is optional.

Create a workflow πŸ“

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

πŸ“‹ Usage

Sync labels to a list of repositories πŸ“¦

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.

Get Labels of url πŸ”—

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

Auto Discover Repositories πŸ”

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

πŸ› οΈ Built With

πŸ–‡οΈ Contributing

Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.

πŸ“– Wiki

You can find more information about this project on the wiki.

πŸ“Œ Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

βœ’οΈ Authors

See also the list of contributors who participated in this project.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details

🎁 Acknowledgments

About

Keeps your labels in sync in a GitHub repo(s) from a config file. Manage all tags from all your repositories in a single place.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks