๐Ÿท๏ธ Github CLI v2.9.0 is out : clone labels feature #5452 is here

adriens - Apr 27 '22 - - Dev Community

๐Ÿ™‹ Intro

GitHub CLI v2.9.0 is out and brings some nice new features around labels :

Image description

As recently I felt the need (for organizational level reporting) to synchronize labels on distinct repos (see dedicated feedback) :
Image description

, this latest release was the perfect match โฃ๏ธ

๐ŸŽž๏ธ The demo

A short video worths a thousand words so here go ๐Ÿ‘‡

๐Ÿ“œ Movie script

โš ๏ธ Replace with your accountโš ๏ธ

clear

# ๐Ÿค” So a new release is avilable for Gtihub Cli โ”
# ๐Ÿ‘‰ What's new on v2.9.0... let's find out ๐Ÿ‘‡  
gh release view v2.9.0 --repo cli/cli

# ๐ŸŽ ... and what is cli/cli #5452 "label clone" feature โ”
gh issue view 5452 --repo cli/cli

# ๐Ÿ†— Let's give it a try โฃ๏ธ

# 1๏ธโƒฃ Create a master repo 
gh repo create gh-cli-demo-labels-master --public 

# ๐Ÿท๏ธ See labels on the newly created repo ๐Ÿ‘‡
gh label list --repo adriens/gh-cli-demo-labels-master

# โž• Create a custom label ๐Ÿฆฉ
gh label create SOMETHING_PINK --description "I love pink things" --color FFC0CB --repo adriens/gh-cli-demo-labels-master

# โœ… And check it has been created  ๐Ÿ‘‡
gh label list --repo adriens/gh-cli-demo-labels-master

# ๐Ÿ” Look for the newly created label ๐Ÿ‘‡
gh label list --repo adriens/gh-cli-demo-labels-master | grep PINK

# โž•  Now, create a new repo...
gh repo create gh-cli-demo-labels-synced --public 

# ... List existing labels on te newly created repo
gh label list --repo adriens/gh-cli-demo-labels-synced

# โœ… Check that the PINK label does not exists
gh label list --repo adriens/gh-cli-demo-labels-synced | grep PINK

# ๐Ÿช„ Sync labels โœจ
gh label clone adriens/gh-cli-demo-labels-master --repo adriens/gh-cli-demo-labels-synced

# ๐Ÿ•ต๏ธ See if the clone command did work ๐Ÿคž
gh label list --repo adriens/gh-cli-demo-labels-synced | grep PINK

# ๐ŸŽ† Job done ๐Ÿคธ

# ๐Ÿงฝ Cleanup the mess ๐Ÿงผ
gh repo delete adriens/gh-cli-demo-labels-master --confirm
gh repo delete adriens/gh-cli-demo-labels-synced --confirm

# ๐ŸŽฌ That's all folks
gh repo view cli/cli

# ๐ŸŒŸ Go like it ๐ŸŒŸ
gh repo view cli/cli --web
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”– Resources

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .