dependabot.star¶
Detect package ecosystems, write a Dependabot configuration, and edit existing ones.
load("@fleet//dependabot.star", "find", "ecosystems", "config", "write_if_missing", "add_update", "set_option")
| Function | What it does |
|---|---|
find |
Finds the repo's Dependabot configuration. |
ecosystems |
Detects the package ecosystems a repo uses, from files at its root. |
config |
Builds the text of a dependabot.yml with one update entry per ecosystem. |
write_if_missing |
Writes .github/dependabot.yml for the detected ecosystems unless a config exists. |
add_update |
Adds an update entry to an existing Dependabot config, unless one covers that ecosystem and directory. |
set_option |
Sets an option on update entries, such as open-pull-requests-limit or rebase-strategy. |
find¶
Finds the repo's Dependabot configuration.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: The path of .github/dependabot.yml or .github/dependabot.yaml, or None when the repo has neither.
Example
ecosystems¶
Detects the package ecosystems a repo uses, from files at its root.
Recognizes gomod, npm, pip, cargo, bundler, composer, maven, gradle, docker and github-actions.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: The Dependabot ecosystem names, in a fixed order.
Example
Used in: dependabot-ecosystems
config¶
Builds the text of a dependabot.yml with one update entry per ecosystem.
Arguments
| Name | Description |
|---|---|
ecosystems |
The ecosystem names, such as from ecosystems(repo). |
interval |
How often each ecosystem is checked. |
group |
When True, minor and patch updates come as one PR per ecosystem. |
prefixes |
Commit message prefixes by ecosystem; the default is ci(deps) for github-actions and build(deps) for the rest. |
Returns: The YAML text.
Example
text = config(["gomod"], interval = "daily", group = False)
repo.write(".github/dependabot.yml", text)
write_if_missing¶
Writes .github/dependabot.yml for the detected ecosystems unless a config exists.
Repos with a config, or with no ecosystem detected, are left alone.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
interval |
Passed to config. |
group |
Passed to config. |
prefixes |
Passed to config. |
Returns: The ecosystems written, or an empty list.
Example
Used in: add-dependabot
add_update¶
Adds an update entry to an existing Dependabot config, unless one covers that ecosystem and directory.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
ecosystem |
The package ecosystem, such as docker or gomod. |
directory |
The directory Dependabot looks in. |
interval |
How often to check. |
prefix |
The commit message prefix; ci(deps) for github-actions and build(deps) otherwise when None. |
Returns: True when the file changed; False when the entry exists or the repo
has no config (use write_if_missing to create one).
Example
.github/dependabot.yml
Used in: dependabot-ecosystems
set_option¶
Sets an option on update entries, such as open-pull-requests-limit or rebase-strategy.
An existing option is replaced; a missing one is added to the entry.
Use schedule.interval for the check interval.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
key |
The option, dotted for nested ones, such as schedule.interval. |
value |
A string, number or boolean. |
ecosystem |
Only entries for this ecosystem change; every entry when None. |
Returns: True when the file changed.
Example
set_option(repo, "schedule.interval", "weekly", ecosystem = "npm")
set_option(repo, "open-pull-requests-limit", 5, ecosystem = "npm")
# returns True
.github/dependabot.yml
Used in: dependabot-ecosystems