From 65657fdea1a64383a7f0057423a569de2bcc56dc Mon Sep 17 00:00:00 2001 From: Justin Pierce <2170989+justin-pierce@users.noreply.github.com> Date: Wed, 19 Jun 2024 00:42:40 -0400 Subject: [PATCH] feat(parser-emoji): ability to define other emoji --- docs/commit-parsing.rst | 5 +++++ docs/configuration.rst | 3 +++ semantic_release/commit_parser/emoji.py | 7 ++++++- tests/const.py | 2 +- .../commit_parser/test_emoji.py | 18 +++++++++++++----- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/docs/commit-parsing.rst b/docs/commit-parsing.rst index 24952df1b..68059cca6 100644 --- a/docs/commit-parsing.rst +++ b/docs/commit-parsing.rst @@ -116,6 +116,11 @@ The default configuration options for ":robot:", ":green_apple:", ] + non_triggering_tags = [ + ":memo:", + ":construction_worker:", + ":recycle:", + ] .. _commit-parser-scipy: diff --git a/docs/configuration.rst b/docs/configuration.rst index 220d853bb..8e62a40b4 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -657,6 +657,9 @@ the expections from ``commit_parser`` value to default options value. ":apple:", ":penguin:", ":checkered_flag:", ":robot:", ":green_apple:" ] + non_triggering_tags = [ + ":memo:", ":construction_worker:", ":recycle:" + ] ``"scipy"`` -> .. code-block:: toml diff --git a/semantic_release/commit_parser/emoji.py b/semantic_release/commit_parser/emoji.py index 9a2543dfa..8c2c5c5e9 100644 --- a/semantic_release/commit_parser/emoji.py +++ b/semantic_release/commit_parser/emoji.py @@ -41,6 +41,11 @@ class EmojiParserOptions(ParserOptions): ":robot:", ":green_apple:", ) + non_triggering_tags: Tuple[str, ...] = ( + ":memo:", + ":construction_worker:", + ":recycle:", + ) default_bump_level: LevelBump = LevelBump.NO_RELEASE @@ -66,7 +71,7 @@ def get_default_options() -> EmojiParserOptions: def parse(self, commit: Commit) -> ParseResult: all_emojis = ( - self.options.major_tags + self.options.minor_tags + self.options.patch_tags + self.options.major_tags + self.options.minor_tags + self.options.patch_tags + self.options.non_triggering_tags ) message = str(commit.message) diff --git a/tests/const.py b/tests/const.py index 06007e757..b5dda5279 100644 --- a/tests/const.py +++ b/tests/const.py @@ -55,7 +55,7 @@ ] EMOJI_COMMITS_MINOR = [ ":sparkles: something special\n", - ":sparkles::pencil: docs for something special\n", + ":sparkles::memo: docs for something special\n", ":bug: needed a tweak\n", "tweaked again\n", "tweaked again\n", diff --git a/tests/unit/semantic_release/commit_parser/test_emoji.py b/tests/unit/semantic_release/commit_parser/test_emoji.py index 210afe638..8dc475e1a 100644 --- a/tests/unit/semantic_release/commit_parser/test_emoji.py +++ b/tests/unit/semantic_release/commit_parser/test_emoji.py @@ -40,20 +40,28 @@ [":bug: Fixing a bug", "The bug is finally gone!"], [], ), - # No release + # No release with specified emoji ( - ":pencil: Documentation changes", + ":memo: Documentation changes", + LevelBump.NO_RELEASE, + ":memo:", + [":memo: Documentation changes"], + [], + ), + # No release with random emoji + ( + ":construction: Work in progress", LevelBump.NO_RELEASE, "Other", - [":pencil: Documentation changes"], + [":construction: Work in progress"], [], ), # Multiple emojis ( - ":sparkles::pencil: Add a feature and document it", + ":sparkles::memo: Add a feature and document it", LevelBump.MINOR, ":sparkles:", - [":sparkles::pencil: Add a feature and document it"], + [":sparkles::memo: Add a feature and document it"], [], ), # Emoji in description
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: