tools/bump: reformat after the toolchain moves

nixpkgs decides which prettier and gofumpt format the tree. A lock bump to
prettier 3.9.6 reformatted CHANGELOG.md, which no area had touched, and the
formatting check failed on a file the bot never edited.
This commit is contained in:
Kristoffer Dalby
2026-09-09 13:03:21 +00:00
parent d33ed80c41
commit 2cf100360d
2 changed files with 35 additions and 1 deletions
+24
View File
@@ -129,3 +129,27 @@ func gateGenerate(ctx context.Context, r *repo) error {
return nil
}
// applyFormat re-runs the repository formatters. A toolchain bump can change
// what "formatted" means: a newer prettier out of nixpkgs reformats files no
// bump touched, and the formatting check then fails on a tree the bot never
// edited. Running last means it also tidies whatever the generators emitted.
func applyFormat(ctx context.Context, r *repo) (change, error) {
if _, err := r.nixRun(ctx, "make", "fmt"); err != nil { //nolint:noinlineerr
return change{}, err
}
touched, err := changedFiles(ctx, r)
if err != nil {
return change{}, err
}
if len(touched) == 0 {
return change{Empty: true}, nil
}
return change{
Summary: fmt.Sprintf("%d file(s) reformatted", len(touched)),
Detail: touched,
}, nil
}