From f39fc8e4ec9392018642fb4abf7787f75c8dc225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gr=C3=BCter?= Date: Mon, 13 Nov 2023 19:38:01 +0100 Subject: [PATCH 01/16] Uncouple PRs and summaries with new ChangeNote class The new dataclass ChangeNote helps with uncoupling the `_query.py` logic and the `_format.py` logic from each other somewhat. In this case one pull request can be turned into multiple change notes which might appear in separate sections. This optional behavior allows to deal with somewhat large or unfocused pull requests. Long-term this step would also be necessary in case PyGitHub is replaced with a GraphQl-based approach. --- README.md | 12 ++- src/changelist/_cli.py | 10 ++- src/changelist/_format.py | 132 +++++++++++++++++++---------- src/changelist/default_config.toml | 12 ++- 4 files changed, 111 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 270196a..38b401a 100644 --- a/README.md +++ b/README.md @@ -83,17 +83,21 @@ ignored_user_logins = [ ] # If this regex matches a pull requests description, the captured content -# is included instead of the pull request title. +# is included instead of the pull request title. The regex is allowed to match +# more than once in which case a single pull request may result in multiple +# items. Each summary can optionally be prefixed with a `Label:` which takes +# precedence over the pull requests labels. This is useful if one pull request +# should be summarized in different sections. # E.g. the default regex below is matched by # # ```release-note -# An ideally expressive description of the change that is included as a single -# bullet point. Newlines are removed. +# Label: An ideally expressive description of the change that is included as +# a single bullet point. Newlines are removed. # ``` # # If you modify this regex, make sure to match the content with a capture # group named "summary". -pr_summary_regex = "^```release-note\\s*(?P[\\s\\S]*?\\w[\\s\\S]*?)\\s*^```" +pr_summary_regex = "^```release-note\\s*((?P