Skip to content

Commit

Permalink
chore: write description to a file (#2548)
Browse files Browse the repository at this point in the history
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))).
  • Loading branch information
JoeWang1127 committed Mar 8, 2024
1 parent 1a3fd17 commit 2659f91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion library_generation/generate_pr_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,16 @@ def generate(
repo_url: str,
baseline_commit: str,
) -> str:
return generate_pr_descriptions(
description = generate_pr_descriptions(
generation_config_yaml=generation_config_yaml,
repo_url=repo_url,
baseline_commit=baseline_commit,
)
idx = generation_config_yaml.rfind("/")
config_path = generation_config_yaml[:idx]
with open(f"{config_path}/pr_description.txt", "w+") as f:
f.write(description)
return description


def generate_pr_descriptions(
Expand Down
2 changes: 1 addition & 1 deletion library_generation/test/integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def __get_config_files(cls, path: str) -> List[tuple[str, str]]:
if sub_dir.is_file():
continue
repo = sub_dir.name
if repo == "golden":
if repo == "golden" or repo == "java-bigtable":
continue
config = f"{sub_dir}/{config_name}"
config_files.append((repo, config))
Expand Down

0 comments on commit 2659f91

Please sign in to comment.