Find & replace labels in GitHub issues and pull requests
This tool requires a GitHub token to be set in GH_TOKEN environment variable. You can generate a token in your GitHub account settings:
- Go to Github settings -> Developer settings
- Click Personal access tokens -> Tokens (classic)
- Click "Generate new token"
- Create a token with
repopermissions (orpublic_repoif you're only going to use it with public repositories) - Copy the token and set it in
GH_TOKENenvironment variable, or pass it as a command line parameter (see example below)
$ python3 gh-label-replace.py [params] <owner> <repo> <old_labels> <new_labels>Parameters:
-s--start-date- start date in YYYY-MM-DD format-o--overwrite- overwrite all existing labels completely-d--dry-run- do not actually change anything, just print what would be doneowner- GitHub repository owner/organizationrepo- GitHub repository nameold_labels- comma-separated list of old labelsnew_labels- comma-separated list of new labels
Example:
$ GH_TOKEN='exampleToken' python3 gh-label-replace.py --start-date=2020-01-01 trustmaster gh-labels-replace "bug,enhancement" "bug,feature"