Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drbarnabus/label-sync
Github Action to sync labels in a particular repo with a yaml file for easy cross repo configuration.
https://github.com/drbarnabus/label-sync
actions github github-action github-actions labels sync synchronization
Last synced: 9 days ago
JSON representation
Github Action to sync labels in a particular repo with a yaml file for easy cross repo configuration.
- Host: GitHub
- URL: https://github.com/drbarnabus/label-sync
- Owner: DrBarnabus
- License: mit
- Created: 2022-08-26T16:39:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-10T19:31:04.000Z (2 months ago)
- Last Synced: 2024-09-10T21:58:06.111Z (2 months ago)
- Topics: actions, github, github-action, github-actions, labels, sync, synchronization
- Language: TypeScript
- Homepage:
- Size: 641 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# label-sync
Github Action to sync labels in a particular repo with a yaml file for easy cross repo configuration.
## Example
`.github/labels.yml`
```yaml
labels:
- name: bug
description: 'Label for a bug'
color: 'd73a4a'
- name: feature
color: '00ff00'
````.github/workflows/label-sync.yml`
```yaml
name: 'Label Sync'
on:
push:
branches:
- main
paths:
- .github/workflows/label-sync.yml
- .github/labels.ymljobs:
label-sync:
name: 'Sync Labels'
runs-on: ubuntu-latest
steps:
- uses: DrBarnabus/label-sync@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
```## Workflow Parameters
__github-token__ - The GitHub API Token, for example `${{ secrets.GITHUB_TOKEN }}`
__config-path__ - Optional override for the path to the configuration file. Defaults to `.github/labels.yml`
__owner__ - Optional override for the repo owner to apply to (if not appling to this repo)
__repo__ - Optional override for the repo to apply to (if not appling to this repo)## Applying to multiple repos
Although recommended to have a `labels.yml` in each repository you are managing. In an advanced use case, you may want to have a global configuration for your labels and apply to many repos in the same organization/user (or even across multiple organizations/users).
To achieve this you must provide a PAT (Personal access token) for a github account with access to all repos. You can the use a workflow configuration similar to below to run the step for all repos listed.
`.github/workflows/label-sync.yml`
```yaml
name: 'Label Sync'
on:
push:
branches:
- main
paths:
- .github/workflows/label-sync.yml
- .github/labels.ymljobs:
label-sync:
name: 'Sync Labels'
runs-on: ubuntu-latest
strategy:
matrix:
repo: ['repo-one', 'repo-two', 'repo-three']
steps:
- uses: DrBarnabus/label-sync@v1
with:
github-token: ${{ secrets.GITHUB_PAT }}
owner: 'DrBarnabus'
repo: ${{ matrix.repo }}
```_To sync to multiple organizations/users add more jobs with the appropriate repositories listed._