项目作者: micnncim

项目描述 :
GitHub Action to sync GitHub labels in the declarative way
高级语言: Go
项目地址: git://github.com/micnncim/action-label-syncer.git
创建时间: 2019-10-13T14:25:41Z
项目社区:https://github.com/micnncim/action-label-syncer

开源协议:Apache License 2.0

下载


logo

actions-workflow-test
actions-marketplace
release
pkg.go.dev
dependabot
license

GitHub Actions workflow to sync GitHub labels in the declarative way.

By using this workflow, you can sync current labels with labels configured in a YAML manifest.

Usage

Create YAML manifest of GitHub labels

  1. - name: bug
  2. description: Something isn't working
  3. color: d73a4a
  4. - name: documentation
  5. description: Improvements or additions to documentation
  6. color: 0075ca
  7. - name: duplicate
  8. description: This issue or pull request already exists
  9. color: cfd3d7

The default file path is .github/labels.yml, but you can specify any file path with jobs.<job_id>.steps.with.manifest.

To create manifest of the current labels easily, using label-exporter is recommended.

Create Workflow

An example workflow is here.

  1. name: Sync labels
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths:
  7. - path/to/manifest/labels.yml
  8. jobs:
  9. build:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v2
  13. - uses: micnncim/action-label-syncer@v1
  14. env:
  15. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  16. with:
  17. manifest: path/to/manifest/labels.yml

If a label color or description changes, the same label is updated with the new color or description. If a label name changes, the previous label is deleted by default.
Also all existing labels which not listed in manifest will be deleted by default.
All issues and PRs that were previously labeled with this label are now unlabeled.

You can add jobs.<job_id>.steps.with.prune: false in order to preserver all existing labels which is not mentioned in manifest, in this case when a label will be renamed old label will be not deleted.

Sync labels on another repository

It is also possible to specify a repository or repositories as an input to the action. This is useful if you want to store your labels somewhere centrally and modify multiple repository labels.

Note: The default GITHUB_TOKEN will not have permissions to operate on other repositories so you must specify a personal access token in your secrets.

  1. name: Sync labels
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths:
  7. - path/to/manifest/labels.yml
  8. jobs:
  9. build:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v2
  13. - uses: micnncim/action-label-syncer@v1
  14. with:
  15. manifest: path/to/manifest/labels.yml
  16. repository: |
  17. owner/repository-1
  18. owner/repository-2
  19. token: ${{ secrets.PERSONAL_TOKEN }}

Project using action-label-syncer

If you’re using action-label-syncer in your project, please send a PR to list your project!

See also

Note

Icon made by bqlqn from www.flaticon.com