Sharing Github Labels across Repositories

apoclyps

Kyle Harrison

Posted on February 3, 2023

Sharing Github Labels across Repositories

Labels (https://github.com/hackebrot/labels) is a CLI app for managing GitHub labels. It allows labels to be fetched and stored in a toml file (which can then be updated to include the required labels on another repository). Once fetched, the labels can then be synced to another repository.

Getting setup

pip install labels

export LABELS_USERNAME="apoclyps"
export LABELS_TOKEN=$GITHUB_TOKEN
Enter fullscreen mode Exit fullscreen mode

Now you are ready to fetch labels from your chosen repository

Copying labels

labels fetch -o apoclyps -r reviews
Enter fullscreen mode Exit fullscreen mode

This will create an output file in your current working directory called labels.toml

[bug]
color = "d73a4a"
name = "bug"
description = "Something isn't working"

[config]
color = "93447B"
name = "config"
description = ""

["contains: migrations"]
color = "EDFA48"
name = "contains: migrations"
description = ""

[dependencies]
color = "030750"
name = "dependencies"
description = ""
Enter fullscreen mode Exit fullscreen mode

Syncing labels

To do a dry run using the -n flag to see what changes would be applied

labels sync -n -o apoclyps -r deps 
Enter fullscreen mode Exit fullscreen mode
This would delete the following labels:
  - yaml
This would update the following labels:
  - contains: migrations
  - dependencies
This would create the following labels:
  - config
This would NOT modify the following labels:
  - bug
Enter fullscreen mode Exit fullscreen mode

If you are happy with the changes, rerun the same command without -n to apply the labels to the repository:

labels sync -n -o apoclyps -r deps 
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
apoclyps
Kyle Harrison

Posted on February 3, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Code Call v0.1.0 (Beta) Release Notes
opensource Code Call v0.1.0 (Beta) Release Notes

October 12, 2024

SonarQube vs Fortify
codeanalysis SonarQube vs Fortify

December 12, 2023

How to work with git submodules
git How to work with git submodules

November 1, 2023