Documentation
¶
Overview ¶
Package bump recognizes a dependency-update pull request from its title, as Dependabot and Renovate write them, and says how big its version jump is.
It reads only the title, so it needs no request of its own. It is conservative: a title it cannot read with confidence is not a dependency update, since calling an ordinary pull request one is worse than missing one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level string
Level is how big a version change is.
const ( // LevelUnknown is a change that couldn't be judged. LevelUnknown Level = "" // LevelPatch is a change in the third or a later version part, or only in a suffix. LevelPatch Level = "patch" // LevelMinor is a change in the second version part. LevelMinor Level = "minor" // LevelMajor is a change in the first version part. LevelMajor Level = "major" )
func Compare ¶
Compare says how big the change from one version to another is: major, minor, or patch by the first numeric part that differs, patch when only a suffix or a further part does, and LevelUnknown for the same version or for one that has no numeric part, such as a digest or "latest". A downgrade reports the level of the part that changed.
Each side may carry a range operator ("^", "~", "~>", ">=", "=") and a leading "v". Only the leading run of dot-separated numeric parts is compared: "3-beta" counts as 3 and ends the run.
type Update ¶
type Update struct {
// Name is the dependency, such as "golang.org/x/net": "" for a group, for two or more
// dependencies updated together, and for Renovate's updates of all dependencies.
Name string `json:"name"`
// From is the version the dependency moves from, as written, or "" when the title
// doesn't say, as Renovate's don't.
From string `json:"from"`
// To is the version the dependency moves to, as written ("v4" or "4", as the title
// has it).
To string `json:"to"`
// Group is a Dependabot group's name, or "" for an update outside a group.
Group string `json:"group"`
// Dir is the directory the update is in, such as "/frontend", or "" for the root and
// when the title doesn't say.
Dir string `json:"dir"`
// Count is how many dependencies the pull request updates: 1 for a single one, N for
// a group "with N updates", and 0 when the title doesn't say, as for Renovate's
// updates of all dependencies and of a monorepo's packages.
Count int `json:"count"`
// Level is how big the version jump is, LevelUnknown when the title can't tell.
Level Level `json:"level"`
// Security is a security update, marked [Security] or [SECURITY] in the title.
Security bool `json:"security"`
}
Update is what a dependency-update title says.
func Parse ¶
Parse reads a pull request's title as a dependency update, and reports false for a title that is not one.
It reads Dependabot's titles ("bump X from A to B", in a directory or a group, "update X requirement from A to B", "bump the G group with N updates", "bump X and Y") and Renovate's ("update dependency X to V", "update module X to V", "update X action to V", "update X docker tag to V", "update X digest to D", "update X monorepo to V", "update all dependencies"), after a conventional-commit prefix such as "build(deps): ", either tool's security marker, and a level in parentheses such as " (major)", which sets the level when present.