tools/bump: say which gates actually ran

The body claimed the nix checks had run regardless of --gate, which is
exactly the sort of thing a reviewer takes at face value.
This commit is contained in:
Kristoffer Dalby
2026-09-04 14:43:57 +00:00
parent 57034c314a
commit 611a70dff2
4 changed files with 28 additions and 9 deletions
+3 -2
View File
@@ -29,7 +29,7 @@ import (
)
type runFlags struct {
DryRun bool `flag:"dry-run,default=false,Apply and report, but run no final gate and touch no remote"`
DryRun bool `flag:"dry-run,default=false,Rebuild the branch locally and report, but run no final gate and touch no remote"`
NoPR bool `flag:"no-pr,default=false,Push nothing and open no pull request"`
Areas string `flag:"areas,Comma-separated areas to run (default: all)"`
Skip string `flag:"skip,Comma-separated areas to skip"`
@@ -136,7 +136,7 @@ func cmdRun(ctx context.Context) error {
return err
}
body := renderBody(results, markerOf(results, tree, head))
body := renderBody(results, markerOf(results, tree, head), gate)
if err := writeStepSummary(body); err != nil { //nolint:noinlineerr
return err
@@ -165,6 +165,7 @@ func cmdRun(ctx context.Context) error {
Branch: runCfg.Branch,
Base: runCfg.Base,
Title: "all: bump pinned versions",
Gate: gate,
Force: runCfg.Force,
}, results)
}
+2 -1
View File
@@ -81,6 +81,7 @@ type publishOptions struct {
Branch string
Base string
Title string
Gate string
Force bool
}
@@ -99,7 +100,7 @@ func publish(ctx context.Context, r *repo, opt publishOptions, results []result)
}
now := markerOf(results, tree, head)
body := renderBody(results, now)
body := renderBody(results, now, opt.Gate)
pr, err := lookupPR(ctx, r, opt.Slug, opt.Branch)
if err != nil {
+22 -5
View File
@@ -63,7 +63,7 @@ func markerOf(results []result, tree, head string) marker {
// renderBody writes the pull request body. It leads with what landed and what
// did not, because the point of the bot is that the reader can decide from the
// body plus the checks without reproducing the run.
func renderBody(results []result, m marker) string {
func renderBody(results []result, m marker, gate string) string {
var sb strings.Builder
sb.WriteString("Automated version bump.\n\n")
@@ -81,8 +81,8 @@ func renderBody(results []result, m marker) string {
writeDetails(&sb, results)
writeDropped(&sb, results)
sb.WriteString("\nThe integration matrix is left to this pull request's own CI; ")
sb.WriteString("the nix checks and the tailscale builder images were already run in the bump job.\n")
sb.WriteString("\n")
sb.WriteString(gateNote(gate))
sb.WriteString("\n")
sb.WriteString(m.render())
sb.WriteString("\n")
@@ -158,14 +158,31 @@ func writeLog(sb *strings.Builder, log string) {
sb.WriteString("\n ```\n")
}
// gateNote says what the bump job did and did not already run, so the reader
// knows how much of the green tick below is new information.
func gateNote(gate string) string {
switch gate {
case gateFull:
return "The nix checks and the tailscale builder images were already run in the bump job; " +
"the integration matrix is left to this pull request's own CI.\n"
case gateQuick:
return "Only `nix build .#checks.<system>.build` was run in the bump job; " +
"everything else is left to this pull request's own CI.\n"
default:
return "No gate was run in the bump job; every check below is the first one.\n"
}
}
// cell keeps a markdown table cell from breaking the table.
func cell(s string) string {
s = strings.ReplaceAll(s, "|", "\\|")
s = strings.ReplaceAll(s, "\n", " ")
const maxCell = 160
if len(s) > maxCell {
s = s[:maxCell] + "…"
runes := []rune(s)
if len(runes) > maxCell {
s = string(runes[:maxCell]) + "…"
}
if s == "" {
+1 -1
View File
@@ -26,7 +26,7 @@ func TestMarkerRoundTrip(t *testing.T) {
}
want := markerOf(results, "tree-sha", "head-sha")
body := renderBody(results, want)
body := renderBody(results, want, gateFull)
got, ok := parseMarker(body)
if !ok {