@@ -90,7 +90,7 @@ type MergeRequest struct {
9090
9191var baseURL string
9292
93- const LABEL_COLOR = "#8fbc8f" //nolint:stylecheck
93+ const LABEL_COLOR = "#8fbc8f"
9494
9595func main () {
9696 _ = godotenv .Overload ()
@@ -143,34 +143,41 @@ func main() {
143143
144144 gitlabToken := os .Getenv ("GITLAB_TOKEN" )
145145
146- CI_MERGE_REQUEST_IID_STR := os .Getenv ("CI_MERGE_REQUEST_IID" ) //nolint:stylecheck
146+ CI_MERGE_REQUEST_IID_STR := os .Getenv ("CI_MERGE_REQUEST_IID" )
147147 if CI_MERGE_REQUEST_IID_STR == "" {
148148 slog .Error ("CI_MERGE_REQUEST_IID not set" )
149149 os .Exit (1 )
150150 }
151- CI_MERGE_REQUEST_IID , err := strconv .Atoi (CI_MERGE_REQUEST_IID_STR ) //nolint:stylecheck
151+ CI_MERGE_REQUEST_IID , err := strconv .Atoi (CI_MERGE_REQUEST_IID_STR )
152152 if err != nil {
153153 slog .Error (err .Error ())
154154 os .Exit (1 )
155155 }
156156
157- CI_PROJECT_ID := os .Getenv ("CI_PROJECT_ID" ) //nolint:stylecheck
157+ CI_PROJECT_ID := os .Getenv ("CI_PROJECT_ID" )
158158 if CI_PROJECT_ID == "" {
159159 slog .Error ("CI_PROJECT_ID not set" )
160160 os .Exit (1 )
161161 }
162- question := `<!-- MR BACKPORT QUESTION -->` + "\n " + "Does this needs backport ? \n | Version | label |\n |:--:|:--:|"
162+ sb := strings.Builder {}
163+ sb .WriteString (`<!-- MR BACKPORT QUESTION -->` + "\n " + "Does this needs backport ? \n | Version | label |\n |:--:|:--:|" )
163164 backportLabels := map [string ]struct {}{
164165 "backport-ee" : {},
165166 }
166167 for _ , version := range versions {
167168 ver := strconv .Itoa (int (version .Major ())) + "." + strconv .Itoa (int (version .Minor ()))
168- question += "\n " + "| " + ver + " | " + "backport-" + ver + " |"
169+ sb .WriteString ("\n " )
170+ sb .WriteString ("| " )
171+ sb .WriteString (ver )
172+ sb .WriteString (" | " )
173+ sb .WriteString ("backport-" )
174+ sb .WriteString (ver )
175+ sb .WriteString (" |" )
169176 backportLabels ["backport-" + ver ] = struct {}{}
170177 }
171178 // ee
172- question += "\n " + "| EE | " + "backport-ee |"
173- question += "\n \n " + "please add labels for backporting."
179+ sb . WriteString ( "\n " + "| EE | " + "backport-ee |" )
180+ sb . WriteString ( "\n \n " + "please add labels for backporting." )
174181
175182 mr , err := getMergeRequest (baseURL , gitlabToken , CI_PROJECT_ID , CI_MERGE_REQUEST_IID )
176183 if err != nil {
@@ -199,13 +206,13 @@ func main() {
199206 os .Exit (1 )
200207 }
201208 slog .Info ("No backport question found, creating one as thread" )
202- startThreadOnMergeRequest (baseURL , gitlabToken , CI_PROJECT_ID , CI_MERGE_REQUEST_IID , question )
209+ startThreadOnMergeRequest (baseURL , gitlabToken , CI_PROJECT_ID , CI_MERGE_REQUEST_IID , sb . String () )
203210 }
204211}
205212
206213func startThreadOnMergeRequest (baseURL , token , projectID string , mergeRequestIID int , threadBody string ) {
207214 client := & http.Client {}
208- threadData := map [string ]interface {} {
215+ threadData := map [string ]any {
209216 "body" : threadBody ,
210217 }
211218 threadDataBytes , err := json .Marshal (threadData )
0 commit comments