I'd like to use the same labels across multiple repositories. #7432
Replies: 3 comments 2 replies
-
|
I bumped into this, but I want to add labels for all the projects in my organization. I found out you can manage labels for an entire organization, under Settings -> Repository -> General However, this only works for new repositories, for existing repos this won't work. #!/bin/bash
# Variables
ORG_NAME="your_organization_name"
LABEL_NAME="new-label"
LABEL_COLOR="f29513"
LABEL_DESCRIPTION="Description of the new label"
# Fetch all repositories in the organization
repos=$(gh repo list $ORG_NAME --json name -q '.[].name')
# Loop through each repository and create the label
for repo in $repos; do
echo "Creating label in $repo..."
gh api \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
"/repos/$ORG_NAME/$repo/labels" \
-f name="$LABEL_NAME" \
-f color="$LABEL_COLOR" \
-f description="$LABEL_DESCRIPTION"
done
echo "Label added to all repositories." |
Beta Was this translation helpful? Give feedback.
-
|
This really annoying thing to do in each repo |
Beta Was this translation helpful? Give feedback.
-
|
@michaellenaghan I created a repo where you can use actions to achieve syncing from the "master label repo" with all, are whichever other repos you have. Don't hesitate to try it out: https://github.com/tormigit/label-sync |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
You can't assign labels to a "draft" issue until you a) convert it to an issue and b) assign it to a repository. I understand why it works that way given the history, but: it definitely feels awkward.
Even worse, I'm currently experimenting with all of this, and that includes the labels I attach to issues. My project uses multiple repositories — that's why I'm trying out the new project boards — and that leaves me having to manually sync any label changes across repositories. Again, I understand why it works that way given the history, but: it definitely feels awkward.
What makes this issue particularly painful, I think, is that it hits you immediately, just as you start to try everything out.
Beta Was this translation helpful? Give feedback.
All reactions