Update or migrate github labels on repos in a github org based on a YAML file
A typical labels.yaml file looks like:
---
labels:
- color: 00ff00
name: lgtm
- color: ff0000
name: priority/P0
previously:
- color: 0000ff
name: P0
- name: dead-label
color: cccccc
deleteAfter: 2017-01-01T13:00:00ZThis will ensure that:
- there is a green
lgtmlabel - there is a red
priority/P0label, and previous labels should be migrated to it:- if a
P0label exists:- if
priority/P0does not, modify the existingP0label - if
priority/P0exists,P0labels will be deleted,priority/P0labels will be added
- if
- if a
- if there is a
dead-labellabel, it will be deleted after 2017-01-01T13:00:00Z
# test
go test ./label_sync
# add or migrate labels on all repos in the kubernetes org
go run ./label_sync \
--config $(pwd)/label_sync/labels.yaml \
--token /path/to/github_oauth_token \
--orgs kubernetes
# actually you need to pass the --confirm flag too, it will
# run in dry-run mode by default so you avoid doing something
# too hastily, hence why this copy-pasta isn't including it
# add or migrate labels on all repos except helm in the kubernetes org
go run ./label_sync \
--config $(pwd)/label_sync/labels.yaml \
--token /path/to/github_oauth_token \
--orgs kubernetes \
--skip kubernetes/helm
# see above
# add or migrate labels on the community and steering repos in the kubernetes org
go run ./label_sync \
--config $(pwd)/label_sync/labels.yaml \
--token /path/to/github_oauth_token \
--only kubernetes/community,kubernetes/steering
# see above
# generate docs and a css file contains labels styling based on labels.yaml
go run ./label_sync \
--action docs \
--config $(pwd)/label_sync/labels.yaml \
--docs-template $(pwd)/label_sync/labels.md.tmpl \
--docs-output $(pwd)/label_sync/labels.mdWe run this as a Periodic job ci-test-infra-label-sync configured under config/jobs.
This job read labels.yaml from a ConfigMap that is updated by
the prow updateconfig plugin.
To update the labels.yaml file, make the desired changes to labels.yaml and
run make update-labels from root of this repo. Then open a pull request with the resulting
labels.yaml and labels.md files.