diff --git a/server/events/vcs/bitbucketcloud/client.go b/server/events/vcs/bitbucketcloud/client.go index b926c8cf4a..598bce5df6 100644 --- a/server/events/vcs/bitbucketcloud/client.go +++ b/server/events/vcs/bitbucketcloud/client.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "net/http" + "unicode/utf8" "github.com/pkg/errors" "github.com/runatlantis/atlantis/server/events/models" @@ -179,6 +180,11 @@ func (b *Client) UpdateStatus(repo models.Repo, pull models.PullRequest, status url = b.AtlantisURL } + // Ensure key has at most 40 characters + if utf8.RuneCountInString(src) > 40 { + src = fmt.Sprintf("%.37s...", src) + } + bodyBytes, err := json.Marshal(map[string]string{ "key": src, "url": url,