Skip to content

Commit

Permalink
Add details to changelog
Browse files Browse the repository at this point in the history
Update test suite
  • Loading branch information
philnewm committed Nov 5, 2024
1 parent 6c9ad3a commit 7ede1a9
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 12 deletions.
41 changes: 39 additions & 2 deletions src/conversion_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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.
Expand All @@ -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"<details>\n"
changelog += f"<summary>{change.title} - [#{change.number}]({change.url})</summary>\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"</details>"
changelog += f"</details>\n"

return changelog
92 changes: 82 additions & 10 deletions tests/formatted_changelog.md
Original file line number Diff line number Diff line change
@@ -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)
<details>
<summary>Improve applying render resolution and aspect ratio on render settings reset - [#75](https://github.com/ynput/ayon-maya/pull/75)</summary>

## Bug
<!-- Paragraphs contain detailed information on the changes made to the product or service, providing an in-depth description of the updates and enhancements. They can be used to explain the reasoning behind the changes, or to highlight the importance of the new features. Paragraphs can often include links to further information or support documentation. -->

* 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)
___

</details>
<details>
<summary>Validate unique names only within the instance not in full scene - [#70](https://github.com/ynput/ayon-maya/pull/70)</summary>

<!-- Paragraphs contain detailed information on the changes made to the product or service, providing an in-depth description of the updates and enhancements. They can be used to explain the reasoning behind the changes, or to highlight the importance of the new features. Paragraphs can often include links to further information or support documentation. -->

Validate unique names only within the instance not in full scene

___

</details>

### **Bug**

<details>
<summary>AY-6654 Look: Fix None values in collecting and applying attributes - [#89](https://github.com/ynput/ayon-maya/pull/89)</summary>

<!-- Paragraphs contain detailed information on the changes made to the product or service, providing an in-depth description of the updates and enhancements. They can be used to explain the reasoning behind the changes, or to highlight the importance of the new features. Paragraphs can often include links to further information or support documentation. -->

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.

___

</details>
<details>
<summary>Fix settings for Maya USD Animation Extractor - [#77](https://github.com/ynput/ayon-maya/pull/77)</summary>

<!-- Paragraphs contain detailed information on the changes made to the product or service, providing an in-depth description of the updates and enhancements. They can be used to explain the reasoning behind the changes, or to highlight the importance of the new features. Paragraphs can often include links to further information or support documentation. -->

Fix name in settings to match with name of plug-in to ensure settings are actually applied

___

</details>
<details>
<summary>Improve applying render resolution and aspect ratio on render settings reset - [#75](https://github.com/ynput/ayon-maya/pull/75)</summary>

<!-- Paragraphs contain detailed information on the changes made to the product or service, providing an in-depth description of the updates and enhancements. They can be used to explain the reasoning behind the changes, or to highlight the importance of the new features. Paragraphs can often include links to further information or support documentation. -->

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.

___

</details>
<details>
<summary>Maya Scene exports do not default to including nodes that not children of members - [#71](https://github.com/ynput/ayon-maya/pull/71)</summary>

<!-- Paragraphs contain detailed information on the changes made to the product or service, providing an in-depth description of the updates and enhancements. They can be used to explain the reasoning behind the changes, or to highlight the importance of the new features. Paragraphs can often include links to further information or support documentation. -->

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.

___

</details>

### **Maintenance**

<details>
<summary>Skip extraction of active view for automatic tests - [#126](https://github.com/ynput/ayon-maya/pull/126)</summary>

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.

___

</details>

0 comments on commit 7ede1a9

Please sign in to comment.