Repository navigation
Support creation of labels #1503
Description
Activity
Thanks for the suggestion! You can do so right now with the api command:
gh api --silent repos/:owner/:repo/labels -f name="help wanted" -f color="000000"
Note that the
colorparameter is required.Reacted by Jay Qi, Yaman Aljazairi and Dave- addedneeds-designAn engineering task needs design to proceedAn engineering task needs design to proceed
on Oct 7, 2020 The
apicommand didn't work for me - I guess it does not work well with GitHub Enterprise. I worked around using plain curl, but it does not look as nice as it could with the GitHub CLI.@alterrebe If you remove the
--silentflag, do you get some response back? Also you may add the-iflag to see response headers. If this doesn't work on Enterprise (it absolutely should), please send us more debugging info so we can fix this 🙇Note that for Enterprise you need to set GH_HOST for now:
GH_HOST=example.com gh api repos/:owner/:repo/labels ...
Reacted by Uri SavelchevIf you go for this feature, would it be possible to also do it from the
interactivemode?Therefore, when creating pr instead of only allowing to search among the existing ones, you could create one straight forward?
Note that for Enterprise you need to set GH_HOST for now:
GH_HOST=example.com gh api repos/:owner/:repo/labels ...
This is the point I missed. Other commands work w/o it (I guess they autodetect the
GH_HOSTfrom the.git/configof the current repository, butgh apidoesn't do it).Thank you, it resolved my problem.
I'm closing this as a duplicate of #446 - sorry for missing that the first time around, and please follow along there.
Reacted by Jay Qi and Dmitry Semenovgh api repos/:owner/:repo/labels/my-label-name -X GET --silent || gh api repos/:owner/:repo/labels -f name="my-label-name" -f color="1D76DB" --silentThis works OK for me for now (for an automated script) 😄
actually as of #5316 you can now do:
gh api repos/:owner/:repo/labels/my-label-name -X GET --silent || gh label create my-label-name -c "1D76DB" -d "my label description"
Describe the feature or problem you’d like to solve
I would like the ability to create new labels.
I am using
ghto script populating starter issues on new repositories, and currently it appears one can only assign labels that already exist. Since this is for a new repository, I'd like the ability to also script creating the labels in order to tag the new issues with them.Proposed solution
New subcommand like
gh label create [flags]that works similarly to how it works for issues and pull requests.