File tree 2 files changed +34
-1
lines changed 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ def generate_pr_descriptions(
79
79
The pull request description will be generated into
80
80
description_path/pr_description.txt.
81
81
82
+ If baseline_commit is the same as googleapis commit in the given generation
83
+ config, no pr_description.txt will be generated.
84
+
82
85
:param config: a GenerationConfig object. The googleapis commit in this
83
86
configuration is the latest commit, inclusively, from which the commit
84
87
message is considered.
@@ -90,6 +93,9 @@ def generate_pr_descriptions(
90
93
:param repo_url: the GitHub repository from which retrieves the commit
91
94
history.
92
95
"""
96
+ if baseline_commit == config .googleapis_commitish :
97
+ return
98
+
93
99
paths = config .get_proto_path_to_library_name ()
94
100
description = get_commit_messages (
95
101
repo_url = repo_url ,
@@ -126,6 +132,8 @@ def get_commit_messages(
126
132
:param paths: a mapping from file paths to library_name.
127
133
:param is_monorepo: whether to generate commit messages in a monorepo.
128
134
:return: commit messages.
135
+ :raise ValueError: if current_commit is older than or equal to
136
+ baseline_commit.
129
137
"""
130
138
tmp_dir = "/tmp/repo"
131
139
shutil .rmtree (tmp_dir , ignore_errors = True )
Original file line number Diff line number Diff line change 11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
+ import os
14
15
import unittest
15
16
16
- from library_generation .generate_pr_description import get_commit_messages
17
+ from library_generation .generate_pr_description import (
18
+ get_commit_messages ,
19
+ generate_pr_descriptions ,
20
+ )
21
+ from library_generation .model .generation_config import GenerationConfig
17
22
18
23
19
24
class GeneratePrDescriptionTest (unittest .TestCase ):
@@ -47,3 +52,23 @@ def test_get_commit_messages_current_and_baseline_are_same_raise_exception(self)
47
52
{},
48
53
True ,
49
54
)
55
+
56
+ def test_generate_pr_description_with_same_googleapis_commits (self ):
57
+ commit_sha = "36441693dddaf0ed73951ad3a15c215a332756aa"
58
+ cwd = os .getcwd ()
59
+ generate_pr_descriptions (
60
+ config = GenerationConfig (
61
+ gapic_generator_version = "" ,
62
+ googleapis_commitish = commit_sha ,
63
+ libraries_bom_version = "" ,
64
+ owlbot_cli_image = "" ,
65
+ synthtool_commitish = "" ,
66
+ template_excludes = [],
67
+ grpc_version = "" ,
68
+ protobuf_version = "" ,
69
+ libraries = [],
70
+ ),
71
+ baseline_commit = commit_sha ,
72
+ description_path = cwd ,
73
+ )
74
+ self .assertFalse (os .path .isfile (f"{ cwd } /pr_description.txt" ))
You can’t perform that action at this time.
0 commit comments