1
+ /*
2
+ * Copyright 2025 Google LLC. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
package cmd
2
17
3
18
import (
@@ -15,7 +30,7 @@ import (
15
30
"github.com/spf13/cobra"
16
31
)
17
32
18
- var changelogExp = regexp .MustCompile ("(?s)```release-note.*? ```" )
33
+ var changelogExp = regexp .MustCompile ("(?s)```release-note:(?P<noteType>[a-zA-Z]+).* ```" )
19
34
20
35
var gdEnvironmentVariables = [... ]string {
21
36
"BASE_BRANCH" ,
@@ -354,8 +369,11 @@ func addChangelogEntry(downstreamRepo *source.Repo, pullRequest *github.PullRequ
354
369
return err
355
370
}
356
371
rnr .Mkdir (".changelog" )
357
- if err := rnr .WriteFile (filepath .Join (".changelog" , fmt .Sprintf ("%d.txt" , pullRequest .Number )), strings .Join (changelogExp .FindAllString (pullRequest .Body , - 1 ), "\n " )); err != nil {
358
- return err
372
+ matches := changelogExp .FindStringSubmatch (pullRequest .Body )
373
+ if matches != nil && matches [1 ] != "none" {
374
+ if err := rnr .WriteFile (filepath .Join (".changelog" , fmt .Sprintf ("%d.txt" , pullRequest .Number )), strings .Join (changelogExp .FindAllString (pullRequest .Body , - 1 ), "\n " )); err != nil {
375
+ return err
376
+ }
359
377
}
360
378
return rnr .PopDir ()
361
379
}
0 commit comments