From d8451ae6c2051848acafbd5e117701ba992f404a Mon Sep 17 00:00:00 2001 From: Hugo Shaka Date: Thu, 25 Jan 2024 15:29:45 -0500 Subject: [PATCH] Ignore generated CRDs during size check --- bot/internal/bot/bot.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bot/internal/bot/bot.go b/bot/internal/bot/bot.go index ff2577bb..19a88d44 100644 --- a/bot/internal/bot/bot.go +++ b/bot/internal/bot/bot.go @@ -18,6 +18,7 @@ package bot import ( "context" + "regexp" "strings" "github.com/gravitational/trace" @@ -28,6 +29,10 @@ import ( "github.com/gravitational/shared-workflows/bot/internal/review" ) +// isCRDRegex matches Teleport operator CRD file paths. +// Those files receive a special treatment as they're automatically generated. +var isCRDRegex = regexp.MustCompile(`.*/resources\.teleport\.dev_[[:alpha:]]+\.yaml$`) + // Client implements the GitHub API. type Client interface { // RequestReviewers is used to assign reviewers to a Pull Request. @@ -265,7 +270,8 @@ func skipFileForSizeCheck(name string) bool { strings.HasSuffix(name, "_pb.d.ts") || strings.HasSuffix(name, ".json") || strings.Contains(name, "webassets/") || - strings.Contains(name, "vendor/") + strings.Contains(name, "vendor/") || + isCRDRegex.MatchString(name) } func isReleaseBranch(branch string) bool {