diff --git a/bot/internal/bot/label.go b/bot/internal/bot/label.go index 855d62f..b881ed9 100644 --- a/bot/internal/bot/label.go +++ b/bot/internal/bot/label.go @@ -66,6 +66,12 @@ func (b *Bot) labels(ctx context.Context, files []github.PullRequestFile) ([]str labels = append(labels, string(prSize(files))) } + c := classifyChanges(b.c, files) + if c.Docs && !c.Code { + log.Println("Label: Adding no-changelog because this is a docs-only change.") + labels = append(labels, NoChangelogLabel) + } + // The branch name is unsafe, but here we are simply adding a label. if b.c.Environment.Repository != env.CloudRepo && isReleaseBranch(b.c.Environment.UnsafeBase) { log.Println("Label: Found backport branch.") diff --git a/bot/internal/bot/label_test.go b/bot/internal/bot/label_test.go index fe67391..5c860f5 100644 --- a/bot/internal/bot/label_test.go +++ b/bot/internal/bot/label_test.go @@ -56,7 +56,7 @@ func TestLabel(t *testing.T) { Deletions: 10, }, }, - labels: []string{"documentation", string(small)}, + labels: []string{"documentation", NoChangelogLabel, string(small)}, }, { desc: "helm", @@ -91,7 +91,7 @@ func TestLabel(t *testing.T) { Deletions: 1000, }, }, - labels: []string{"backport", "documentation", string(xlarge)}, + labels: []string{"backport", "documentation", "no-changelog", string(xlarge)}, }, { desc: "web only",