GithubHelp home page GithubHelp logo

github-label-management's Introduction

github label management

This repo is a step-by-step guide/script for managing organization wide github issue labels across all projects.

Before you run the code, explore the directory you just cloned:

.
├── README.md            - You are reading this NOW
├── default-labels.toml  - This is the label format that you are about to apply to ALL OF YOUR ORGANIZATIONS' REPOS. 
├── list-all-repos.py    - Discovers all of your orgainizations repos and clobbers existing lalels with above "default-labels.toml" Making them all identicle.
├── repo-labels          - Check this directory. (Look, don't touch!) These files will all overwritten soon
├── requirements.txt     - Classic python dependancies stuff
└── .env                 - This file is NOT HERE yet. You will add it below

The Result: all of your organizations' repsoitories will have the same github labels

Github labels

Prerequisites

  • Create a github Personal access token
    • Give it a name
    • Only select the repo scope
  • User has access to the github organization

Install

python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip wheel
python3 -m pip install -r requirements.txt

Edit your .env file: Replace "xxxxxxxxxxxxxx" with your token from above. Replace "yyyyyyyyyyyyyy" with your user name.

vim .env

GITHUB_USER_TOKEN="xxxxxxxxxxxxxxxx"
GITHUB_USER_NAME="yyyyyyyyyyyyyy"
LABELS_TOKEN=${GITHUB_USER_TOKEN}
LABELS_USERNAME=${GITHUB_USER_NAME}

Edit the labels

View the labels you are about to apply to your org's repos. If this is your first time through, then look, dont touch. The default labels have been working well

vim default-labels.toml

Run - One project's labels

set -a
source .env
labels sync --owner {{ GITHUB_ORG }} --repo {{ GITHUB_REPO }} --filename default-labels.toml

Run - All Labels

List all your organization's repos:

set -a
source .env
python list-all-repos.py

Make a backup of all current labels

mkdir -p repo-labels
python list-all-repos.py | xargs -I {} labels fetch --owner <GITHUB ORG> --repo {} --filename repo-labels/{}-labels.toml

**Push the default-labels.toml to all of your organization's repositories

python list-all-repos.py | xargs -I {} labels sync --owner <GITHUB ORG> --repo {} --filename default-labels.toml

That's it! The labels have been pushed to all reposities.
Don't like them? Then edit default-labels.toml and run the steps again.

github-label-management's People

Contributors

bryfry avatar joespizz avatar sfeeser avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

github-label-management's Issues

New Labels

Type: Dev - #734AD3
Type: New Feature - #F29BAB

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.