Skip to content

Commit

Permalink
markdown support for json pr updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeker12 committed Nov 1, 2024
1 parent 5d437dc commit afe17b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/scripts/update_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def open_drop_file() -> dict:
with open(DROPFILE_PATH + "/outputs.json", "r", encoding="UTF-8") as f:
return json.load(f)

def wrap_json_markdown(json_string):
return f"```json\n{json_string}\n```"


def get_pr():
"""
Expand Down Expand Up @@ -65,9 +68,9 @@ def update_pr_with_text(pr: github.PullRequest):
json_data = open_drop_file()

if TYPE == "plan":
comments.append(json.dumps(json_data["plan_output"], indent=2))
comments.append(wrap_json_markdown(json.dumps(json_data["plan_output"], indent=2)))

comments.append(json.dumps(json_data, indent=2))
comments.append(wrap_json_markdown(json.dumps(json_data, indent=2)))

try:
for c in comments:
Expand Down
4 changes: 4 additions & 0 deletions .github/scripts/update_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def open_drop_file() -> dict:
with open(DROPFILE_PATH + "/outputs.json", "r", encoding="UTF-8") as f:
return json.load(f)


def wrap_json_markdown(json_string):
return f"```json\n{json_string}\n```"


def get_update_release():
"""gets a tag"""
Expand Down

0 comments on commit afe17b7

Please sign in to comment.