When setting up Dependabot to automatically create pull requests for out-of-date dependencies, you have the option of specifying custom labels to be applied to these PRs; however, if you forget to actually create the labels in your repository, Dependabot won't create them for you, and so they won't be used.
The dependalabels
command provides a simple solution: it extracts the
custom labels from your dependabot.yml
file and ensures that the labels all
exist in your GitHub repository.
dependalabels
requires Python 3.10 or higher. Just use pip for Python 3 (You have pip, right?) to install it:
python3 -m pip install git+https://github.com/jwodder/dependalabels.git
dependalabels [<options>] [<dirpath>]
dependalabels
operates on the Git repository at the specified path,
defaulting to the current directory. The repository's origin
remote must
point to a corresponding GitHub repository. dependalabels
reads
.github/dependabot.yml
at the root of the local repository and ensures that
each custom label listed therein exists in the GitHub repository.
dependalabels
predefines certain labels and gives them specific colors and
descriptions; all other labels are given random colors and empty descriptions.
-f, --force | If a predefined label already exists in the GitHub
repository, ensure its color and description have the
same values as used by dependalabels when creating
the label. |
dependalabels
requires a GitHub access token with appropriate permissions
in order to run. Specify the token via the GH_TOKEN
or GITHUB_TOKEN
environment variable (possibly in an .env
file), by storing a token with
the gh
or hub
command, or by setting the hub.oauthtoken
Git config
option in your ~/.gitconfig
file.