diff --git a/tools/bump/pr.go b/tools/bump/pr.go index a7f5e69e..7cb71864 100644 --- a/tools/bump/pr.go +++ b/tools/bump/pr.go @@ -99,8 +99,7 @@ func publish(ctx context.Context, r *repo, opt publishOptions, results []result) return err } - now := markerOf(results, tree, head) - body := renderBody(results, now, opt.Gate) + body := renderBody(results, markerOf(results, tree, head), opt.Gate) pr, err := lookupPR(ctx, r, opt.Slug, opt.Branch) if err != nil { @@ -114,7 +113,7 @@ func publish(ctx context.Context, r *repo, opt publishOptions, results []result) } if pr != nil && pr.State == "OPEN" { - return updateOpen(ctx, r, opt, pr, body, now) + return updateOpen(ctx, r, opt, pr, body) } if pr != nil && pr.State == "CLOSED" { @@ -138,7 +137,7 @@ func publish(ctx context.Context, r *repo, opt publishOptions, results []result) // updateOpen refreshes an existing pull request in place, but refuses to // force-push over work the bot did not author. -func updateOpen(ctx context.Context, r *repo, opt publishOptions, pr *prState, body string, now marker) error { +func updateOpen(ctx context.Context, r *repo, opt publishOptions, pr *prState, body string) error { prev, hadMarker := parseMarker(pr.Body) remoteTip := remoteBranchSHA(ctx, r, opt.Remote, opt.Branch) @@ -159,15 +158,6 @@ func updateOpen(ctx context.Context, r *repo, opt publishOptions, pr *prState, b return err } - // Only speak up when the outcome actually changed. A daily "still the - // same" comment trains the reader to ignore the thread. - if hadMarker && changedAreas(prev, now) { - if _, err := r.run(ctx, "gh", "pr", "comment", strconv.Itoa(pr.Number), "--repo", opt.Slug, //nolint:noinlineerr - "--body", "The set of applied areas changed since the last run; see the updated description."); err != nil { - return err - } - } - log.Printf("updated pull request #%d", pr.Number) return nil diff --git a/tools/bump/report.go b/tools/bump/report.go index 1210ea5a..e4bfc135 100644 --- a/tools/bump/report.go +++ b/tools/bump/report.go @@ -191,19 +191,3 @@ func cell(s string) string { return s } - -// changedAreas reports whether the outcome differs from the last run, which is -// what decides between silently updating the pull request and commenting on it. -func changedAreas(prev marker, now marker) bool { - if len(prev.Areas) != len(now.Areas) { - return true - } - - for name, st := range now.Areas { - if prev.Areas[name] != st { - return true - } - } - - return false -} diff --git a/tools/bump/report_test.go b/tools/bump/report_test.go index 550c7dd3..ac5f4a9c 100644 --- a/tools/bump/report_test.go +++ b/tools/bump/report_test.go @@ -50,28 +50,6 @@ func TestParseMarkerAbsent(t *testing.T) { } } -func TestChangedAreas(t *testing.T) { - base := marker{Areas: map[string]string{"flake": "applied", "gomod": "applied"}} - - tests := []struct { - name string - now marker - want bool - }{ - {name: "identical", now: marker{Areas: map[string]string{"flake": "applied", "gomod": "applied"}}}, - {name: "state changed", now: marker{Areas: map[string]string{"flake": "applied", "gomod": "dropped"}}, want: true}, - {name: "area added", now: marker{Areas: map[string]string{"flake": "applied", "gomod": "applied", "generate": "applied"}}, want: true}, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - if got := changedAreas(base, test.now); got != test.want { - t.Errorf("changedAreas = %v, want %v", got, test.want) - } - }) - } -} - // A summary containing a pipe would otherwise split the markdown table. func TestCellEscapesTableBreakers(t *testing.T) { got := cell("a | b\nc")