Skip to content

Commit

Permalink
feature(release-controller): Remove empty sections and extra empty li…
Browse files Browse the repository at this point in the history
…nes from published notes
  • Loading branch information
CI Automation committed Sep 3, 2024
1 parent 65e1de7 commit cff47d8
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 2 deletions.
3 changes: 3 additions & 0 deletions release-controller/publish_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def exclusion_reason(line: str) -> str:
changelog += "\n".join(lines)
changelog += "\n"

# remove empty sections
changelog = re.sub(r"[^\n]+\n-+\n(?!\s*\*)", "", changelog, flags=re.S)
changelog = re.sub(r"\n{3,}", "\n\n", changelog, flags=re.S)
return changelog


Expand Down
91 changes: 89 additions & 2 deletions release-controller/test_publish_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ def test_publish_if_ready__ready(mocker):
-------------------------------------------
## Excluded Changes
### Excluded by authors
Expand Down Expand Up @@ -149,6 +147,95 @@ def test_publish_if_ready__ready(mocker):
)


def test_publish_if_ready__remove_empty_sections(mocker):
github_client = Github()
mocker.patch.object(github_client, "get_repo")
repo = github_client.get_repo("dfinity/non-existent-mock")
publish_client = PublishNotesClient(repo)
mocker.patch.object(publish_client, "ensure_published")

publish_client.publish_if_ready(
"""\
Review checklist
================
Please cross\\-out your team once you finished the review
* ~~@team-consensus~~
* ~~@team-crypto~~
* ~~@team-messaging~~
* ~~@team-networking~~
* ~~@node-team~~
* ~~@team-runtime~~
Release Notes for [**rc--2024-02-21\\_23-01**](https://github.com/dfinity/ic/tree/rc--2024-02-21_23-01) (2e921c9adfc71f3edc96a9eb5d85fc742e7d8a9f)
=================================================================================================================================================
Changelog since git revision [8d4b6898d878fa3db4028b316b78b469ed29f293](https://dashboard.internetcomputer.org/release/8d4b6898d878fa3db4028b316b78b469ed29f293)
Bugfixes:
---------
Features:
---------
* ~~author: Igor Novg |~~ [5f9e639d1](https://github.com/dfinity/ic/commit/5f9e639d1) ~~Boundary Nodes: remove njs~~
* ~~author: Igor Novg |~~ [eb7f3dc5c](https://github.com/dfinity/ic/commit/eb7f3dc5c) ~~Boundary Nodes: improve nginx performance~~
* author: Kami Popi | [26f30f055](https://github.com/dfinity/ic/commit/26f30f055) Consensus: Purge non-finalized blocks and notarizations below the finalized height
Tests:
------
Chores:
-------
* author: ~~Leo Eich | [b4673936a](https://github.com/dfinity/ic/commit/b4673936a) Consensus(ecdsa):~~ Make key\\_unmasked\\_ref in PreSignatureQuadrupleRef required
* author: Leo Eich | [b733f7043](https://github.com/dfinity/ic/commit/b733f7043) Consensus(ecdsa): Extend Quadruple state machine in preparation for random unmasked kappa
* ~~author: Leo Eich | [6a4d8962c](https://github.com/dfinity/ic/commit/6a4d8962c) Consensus(ecdsa): Make masked kappa config optional~~
* author: Leo Eich | [e76c5a374](https://github.com/dfinity/ic/commit/e76c5a374) Consensus(ecdsa): Stop relaying tECDSA signature shares
Something:
----------
* author: Leo Eich | [2d63da24c](https://github.com/dfinity/ic/commit/2d63da24c) Consensus(ecdsa): ~~Add optional kappa\\_unmasked config to QuadrupleInCreation~~
Other:
------
""",
"2e921c9adfc71f3edc96a9eb5d85fc742e7d8a9f",
)

# assert publish_client.ensure_published.call_count == 1
publish_client.ensure_published.assert_called_once_with( # pylint: disable=no-member
version="2e921c9adfc71f3edc96a9eb5d85fc742e7d8a9f",
changelog="""\
Release Notes for [**rc--2024-02-21\\_23-01**](https://github.com/dfinity/ic/tree/rc--2024-02-21_23-01) (2e921c9adfc71f3edc96a9eb5d85fc742e7d8a9f)
=================================================================================================================================================
Changelog since git revision [8d4b6898d878fa3db4028b316b78b469ed29f293](https://dashboard.internetcomputer.org/release/8d4b6898d878fa3db4028b316b78b469ed29f293)
Features:
---------
* [`26f30f055`](https://github.com/dfinity/ic/commit/26f30f055) Consensus: Purge non-finalized blocks and notarizations below the finalized height
Chores:
-------
* [`b733f7043`](https://github.com/dfinity/ic/commit/b733f7043) Consensus(ecdsa): Extend Quadruple state machine in preparation for random unmasked kappa
* [`e76c5a374`](https://github.com/dfinity/ic/commit/e76c5a374) Consensus(ecdsa): Stop relaying tECDSA signature shares
## Excluded Changes
### Excluded by authors
* [`5f9e639d1`](https://github.com/dfinity/ic/commit/5f9e639d1) Boundary Nodes: remove njs
* [`eb7f3dc5c`](https://github.com/dfinity/ic/commit/eb7f3dc5c) Boundary Nodes: improve nginx performance
* [`b4673936a`](https://github.com/dfinity/ic/commit/b4673936a) Consensus(ecdsa): Make key\\_unmasked\\_ref in PreSignatureQuadrupleRef required
* [`6a4d8962c`](https://github.com/dfinity/ic/commit/6a4d8962c) Consensus(ecdsa): Make masked kappa config optional
* [`2d63da24c`](https://github.com/dfinity/ic/commit/2d63da24c) Consensus(ecdsa): Add optional kappa\\_unmasked config to QuadrupleInCreation
""",
)


def test_publish_if_ready__not_ready1(mocker):
github_client = Github()
mocker.patch.object(github_client, "get_repo")
Expand Down

0 comments on commit cff47d8

Please sign in to comment.