{"id":24319424,"url":"https://github.com/btskinner/manage_repo_labels","last_synced_at":"2025-10-14T23:05:12.301Z","repository":{"id":84089689,"uuid":"158418665","full_name":"btskinner/manage_repo_labels","owner":"btskinner","description":"Manage repository labels from the command line","archived":false,"fork":false,"pushed_at":"2018-11-20T20:54:20.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-17T15:45:21.225Z","etag":null,"topics":["cli","github-labels","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/btskinner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-20T16:21:55.000Z","updated_at":"2024-09-23T16:52:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"caa0824a-b4f1-4987-8e15-5973bcc4dcf2","html_url":"https://github.com/btskinner/manage_repo_labels","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btskinner%2Fmanage_repo_labels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btskinner%2Fmanage_repo_labels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btskinner%2Fmanage_repo_labels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btskinner%2Fmanage_repo_labels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btskinner","download_url":"https://codeload.github.com/btskinner/manage_repo_labels/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242925948,"owners_count":20207752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","github-labels","python"],"created_at":"2025-01-17T15:33:16.693Z","updated_at":"2025-10-14T23:05:07.269Z","avatar_url":"https://github.com/btskinner.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Rather than managing GitHub issue labels with the web interface, use\nthis script to do so from the command line. This script makes it\neasier to delete default labels and add new ones from a standard\nlist. It's especially useful for organizations or users who want\nconsistent issue labels across a large number of repositories.\n\n## Requirements\n\n* Python 3  \n* Python modules: `json`, `argparse`, and `requests`  \n* [GitHub authorization\n  token](https://help.github.com/articles/authorizing-a-personal-access-token-for-use-with-a-saml-single-sign-on-organization/)  \n\n## Set up\n\n### Get and store authorization token in file\n\nIf you don't have one already, set up an authorization token with\nappropriate permissions [using these\ninstructions](https://help.github.com/articles/authorizing-a-personal-access-token-for-use-with-a-saml-single-sign-on-organization/). Once\ncreated, save your token in a file on your computer. For example, you\nmight create `~/.gh_token` in your home directory that simply\ncontains the token.  \n\n### Label files\n\nNew labels should be stored in a JSON file. For example:\n\n```json\n[\n  {\n\t\"name\": \"Priority: Critical\",\n\t\"description\": \"\",\n\t\"color\": \"e11d21\"\n  },\n  {\n\t\"name\": \"Priority: High\",\n\t\"description\": \"\",\n\t\"color\": \"eb6420\"\n  },\n  {\n\t\"name\": \"Priority: Medium\",\n\t\"description\": \"\",\n\t\"color\": \"fbca04\"\n  },\n  {\n\t\"name\": \"Priority: Low\",\n\t\"description\": \"\",\n\t\"color\": \"009800\"\n  }\n]\n\n```\n\n## Usage\n\nUse the `-h` or `--help` flags to see the scripts arguments (arguments\nin square brackets are optional).\n\n```bash\n[~] $ ./manage_repo_labels.py -h\n\nusage: manage_repo_labels.py [-h] -i ID -t TOKEN -r REPO [-o ORG] [-l LABELS]\n                             [-c] [-d]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -i ID, --id ID        GitHub ID\n  -t TOKEN, --token TOKEN\n                        GitHub authorization token in file\n  -r REPO, --repo REPO  Repository name\n  -o ORG, --org ORG     Organization name\n  -l LABELS, --labels LABELS\n                        Labels in JSON file\n  -c, --check_existing  Flag to check existing labels\n  -d, --drop_existing   Flag to drop existing labels\n```\n\nUsers must supply their GitHub ID, path to authorization token file,\nand the repository name. If the repository is owned by an\norganization, then the the organization name must be included. The\nscript assumes the repository is owned by the user otherwise.\n\n### Check existing\n\n```bash\n./manage_repo_labels.py -i ID -t ~/.github_token -r my_repo -c\n```\n\n### Delete existing\n\n```bash\n./manage_repo_labels.py -i ID -t ~/.github_token -r my_repo -d\n```\n\n### Add new labels\n\n```bash\n./manage_repo_labels.py -i ID -t ~/.github_token -r my_repo -l new_repo_labels.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtskinner%2Fmanage_repo_labels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtskinner%2Fmanage_repo_labels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtskinner%2Fmanage_repo_labels/lists"}