From 7ede1a98b9dabf72e820cd06d86cfcb44edafea8 Mon Sep 17 00:00:00 2001 From: PhilNewm Date: Tue, 5 Nov 2024 09:33:07 +0100 Subject: [PATCH] Add details to changelog Update test suite --- src/conversion_logic.py | 41 +++++++++++++++- tests/formatted_changelog.md | 92 ++++++++++++++++++++++++++++++++---- 2 files changed, 121 insertions(+), 12 deletions(-) diff --git a/src/conversion_logic.py b/src/conversion_logic.py index 73dfb4f..0575c6d 100644 --- a/src/conversion_logic.py +++ b/src/conversion_logic.py @@ -12,6 +12,7 @@ class Changelog(NamedTuple): number: int url: str id: int + body: str def filter_unique_labels(pr_data: List[dict[str, str]]) -> List[str]: @@ -110,12 +111,43 @@ def filter_changes_per_label(pr_data: List[dict[str, str]], changelog_label_list number=pull_request["number"], url=pull_request["url"], id=pull_request["id"], + body=pull_request["body"], ) ) return changes_list +def get_changelog(pr_body: str, changelog_desc: str ="## Changelog Description", heading: str ="##") -> List[str]: + """Get list of changes from a PRs changelog. + + Args: + pr_body list(str): PR body content + changelog_desc (str, optional): Indicates markdown changelog section. Defaults to "## Changes" + heading (str, optional): Markdown heading. Defaults to "##" + + Returns: + list(str): List of changes found. + """ + + lines: list[str] = pr_body.splitlines() + changelog_section = None + description_lines: list[str] = [] + + for line in lines: + if line.startswith(changelog_desc): + changelog_section = True + continue + + if changelog_section and line.startswith(heading): + break + + if changelog_section: + description_lines.append(line.strip()) + + return description_lines + + def format_changelog_markdown(changes: List[Changelog], changelog_label_list: List[str]) -> str: """Create markdown formatted changelog. @@ -139,10 +171,15 @@ def format_changelog_markdown(changes: List[Changelog], changelog_label_list: Li for change in changes: if label in change.labels: + changelog_desc: List[str] = get_changelog(change.body, changelog_desc="## Changelog Description", heading="##") + changelog += f"
\n" changelog += f"{change.title} - [#{change.number}]({change.url})\n\n" - changelog += f"details\n\n\n" + + for desc_line in changelog_desc: + changelog += f"{desc_line}\n" + changelog += f"___\n\n" - changelog += f"
" + changelog += f"\n" return changelog \ No newline at end of file diff --git a/tests/formatted_changelog.md b/tests/formatted_changelog.md index ef9b9bb..f6b1786 100644 --- a/tests/formatted_changelog.md +++ b/tests/formatted_changelog.md @@ -1,17 +1,89 @@ # Changelog -## Enhancement +### **Enhancement** -* Improve applying render resolution and aspect ratio on render settings reset - [75](https://github.com/ynput/ayon-maya/pull/75) -* Validate unique names only within the instance not in full scene - [70](https://github.com/ynput/ayon-maya/pull/70) +
+Improve applying render resolution and aspect ratio on render settings reset - [#75](https://github.com/ynput/ayon-maya/pull/75) -## Bug + -* AY-6654 Look: Fix None values in collecting and applying attributes - [89](https://github.com/ynput/ayon-maya/pull/89) -* Fix settings for Maya USD Animation Extractor - [77](https://github.com/ynput/ayon-maya/pull/77) -* Improve applying render resolution and aspect ratio on render settings reset - [75](https://github.com/ynput/ayon-maya/pull/75) -* Maya Scene exports do not default to including nodes that not children of members - [71](https://github.com/ynput/ayon-maya/pull/71) +Fix pixel aspect ratio / device aspect ratio getting messed up for Arnold renderer on render settings reset. -## Maintenance +Additionally: +- This now applies the resolution from the task entity, not the folder entity. +- This now also applies pixel aspect ratio as defined on the entity. -* Skip extraction of active view for automatic tests - [126](https://github.com/ynput/ayon-maya/pull/126) +___ + +
+
+Validate unique names only within the instance not in full scene - [#70](https://github.com/ynput/ayon-maya/pull/70) + + + +Validate unique names only within the instance not in full scene + +___ + +
+ +### **Bug** + +
+AY-6654 Look: Fix None values in collecting and applying attributes - [#89](https://github.com/ynput/ayon-maya/pull/89) + + + +This fixes a case where looks failed to apply due to `None` values being present in the collected attributes. +These will now be ignored in collected. There's an edge case where Maya returns `None` for string attributes that have no values set - those are captured now explicitly to just `""` to still collect and apply them later. + +Existing looks will now also apply correctly with `None` value in their look attributes, but the attributes with `None` values will be ignored with a warning. + +___ + +
+
+Fix settings for Maya USD Animation Extractor - [#77](https://github.com/ynput/ayon-maya/pull/77) + + + +Fix name in settings to match with name of plug-in to ensure settings are actually applied + +___ + +
+
+Improve applying render resolution and aspect ratio on render settings reset - [#75](https://github.com/ynput/ayon-maya/pull/75) + + + +Fix pixel aspect ratio / device aspect ratio getting messed up for Arnold renderer on render settings reset. + +Additionally: +- This now applies the resolution from the task entity, not the folder entity. +- This now also applies pixel aspect ratio as defined on the entity. + +___ + +
+
+Maya Scene exports do not default to including nodes that not children of members - [#71](https://github.com/ynput/ayon-maya/pull/71) + + + +On Maya scene exports only include the relevant history for the selected nodes downstream and upstream and not upstream, and also their downstream descendant children. + +___ + +
+ +### **Maintenance** + +
+Skip extraction of active view for automatic tests - [#126](https://github.com/ynput/ayon-maya/pull/126) + +It seems that Maya UI is not completely visible or shutting down, `view.readColorBuffer` causes RuntimeError: (kFailure): Unexpected Internal Failure aas view is not visible. + +___ + +