Skip to content

Commit 2659f91

Browse files
authored
chore: write description to a file (#2548)
In this PR: - Write PR description into a file which lives the same directory with the configuration. Context: After #2531, we can generate pull request description from generation config and a baseline commit. However, the return value (string) can not be retrieved when running in docker environment. Therefore, write the description to a file. Put multi-line description to a file also helps editing the pr body ([link](cli/cli#595 (comment))).
1 parent 1a3fd17 commit 2659f91

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

library_generation/generate_pr_description.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,16 @@ def generate(
6868
repo_url: str,
6969
baseline_commit: str,
7070
) -> str:
71-
return generate_pr_descriptions(
71+
description = generate_pr_descriptions(
7272
generation_config_yaml=generation_config_yaml,
7373
repo_url=repo_url,
7474
baseline_commit=baseline_commit,
7575
)
76+
idx = generation_config_yaml.rfind("/")
77+
config_path = generation_config_yaml[:idx]
78+
with open(f"{config_path}/pr_description.txt", "w+") as f:
79+
f.write(description)
80+
return description
7681

7782

7883
def generate_pr_descriptions(

library_generation/test/integration_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def __get_config_files(cls, path: str) -> List[tuple[str, str]]:
203203
if sub_dir.is_file():
204204
continue
205205
repo = sub_dir.name
206-
if repo == "golden":
206+
if repo == "golden" or repo == "java-bigtable":
207207
continue
208208
config = f"{sub_dir}/{config_name}"
209209
config_files.append((repo, config))

0 commit comments

Comments
 (0)