Skip to content

Instantly share code, notes, and snippets.

@lieldulev
Last active February 4, 2016 22:34
Show Gist options
  • Save lieldulev/645889e0e8ebc80c4eaf to your computer and use it in GitHub Desktop.
Save lieldulev/645889e0e8ebc80c4eaf to your computer and use it in GitHub Desktop.
Create a Github-Issues' Label in all repos of an Organization using ghi
#!/bin/bash
# Dependencies
# - curl
# - sed
# - ghi (https://github.com/stephencelis/ghi)
if [ "$#" -ne 5 ];
then
echo ""
echo "ERROR: Illegal number of parameters. Got $#, expecting 5."
echo "Usage:"
echo " ghi-create-label-on-all-repos <github_user> <github_pass> <github_org> <label_name> <label_hex_color>"
echo "Example:"
echo " ghi-create-label-on-all-repos johndoe mypassword MyOrg priority-low fcecae"
else
curl https://$1:$2@api.github.com/orgs/$3/repos | grep '"name"' | sed s/\"name\":\ \"// | sed s/\",// | tr -d " " | xargs -I {} -t ghi label $4 -c $5 -- $3/{}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment