Skip to content

Commit

Permalink
Use the output_file variable when splitting into smaller files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Adams authored and Jake Adams committed Feb 28, 2025
1 parent bb7bf0e commit b6f41ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions issue_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,16 @@ def main(): # pragma: no cover
output_file=output_file,
)

file_name_without_extension = output_file.split(".")[0]
max_char_count = 65535
if markdown_too_large_for_issue_body("issue_metrics.md", max_char_count):
split_markdown_file("issue_metrics.md", max_char_count)
shutil.move("issue_metrics.md", "issue_metrics_full.md")
shutil.move("issue_metrics_0.md", "issue_metrics.md")
if markdown_too_large_for_issue_body(output_file, max_char_count):
split_markdown_file(output_file, max_char_count)
shutil.move(output_file, f"{file_name_without_extension}_full.md")
shutil.move(f"{file_name_without_extension}_0.md", output_file)
print(
"Issue metrics markdown file is too large for GitHub issue body and has been \
split into multiple files. ie. issue_metrics.md, issue_metrics_1.md, etc. \
The full file is saved as issue_metrics_full.md\n\
f"Issue metrics markdown file is too large for GitHub issue body and has been \
split into multiple files. ie. {output_file}, {file_name_without_extension}_1.md, etc. \
The full file is saved as {file_name_without_extension}_full.md\n\
See https://github.com/github/issue-metrics/blob/main/docs/dealing-with-large-issue-metrics.md"
)

Expand Down
2 changes: 1 addition & 1 deletion markdown_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def write_to_markdown(
if search_query:
file.write(f"Search query used to find these items: `{search_query}`\n")

print("Wrote issue metrics to issue_metrics.md")
print(f"Wrote issue metrics to {output_file_name}")


def write_overall_metrics_tables(
Expand Down

0 comments on commit b6f41ce

Please sign in to comment.