Skip to content

Conversation

@kitsuyui
Copy link
Owner

@kitsuyui kitsuyui commented Nov 13, 2022

CustomMessageBuilder

  • This pr adds a new message builder, which allows you to create messages with custom conditions and message body.
  • You can set a message body with first argument.
  • You can enable/disable the default messages with second argument.
  • You can add custom messages with custom conditions and custom message body with third argument.
    const mb = new CustomMessageBuilder(
      // Message body (mustache template)
      `# :tada: Happy commit!\n{{#messages}}- {{&.}}\n{{/messages}}`,
      {
        // enable / disable default patterns
        pr_reaches_power_of_10: true,
        pr_reaches_power_of_2: true,
        pr_reaches_777: true,
        commit_hits_777: true,
        commit_hits_same_numbers: true,
        commit_hits_123: true,
        commit_hits_hexspeak: false,
        commit_hits_666: false,
      },
      [
        // custom messages
        {
          kind: 'pr',
          rule: /(\d)\1{2,}/,
          message: 'Pull request number contains **{{matched[0]}}**!',
        }
      ]
    );

@codecov-commenter
Copy link

codecov-commenter commented Nov 13, 2022

Codecov Report

Base: 16.41% // Head: 50.00% // Increases project coverage by +33.58% 🎉

Coverage data is based on head (9e5f100) compared to base (b14c6ee).
Patch coverage: 58.20% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #11       +/-   ##
===========================================
+ Coverage   16.41%   50.00%   +33.58%     
===========================================
  Files           1        4        +3     
  Lines          67       78       +11     
  Branches       11        8        -3     
===========================================
+ Hits           11       39       +28     
+ Misses         56       39       -17     
Flag Coverage Δ
unittests 50.00% <58.20%> (+33.58%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/github.ts 0.00% <0.00%> (ø)
src/index.ts 0.00% <0.00%> (-16.42%) ⬇️
src/message_builder.ts 95.00% <95.00%> (ø)
src/rules.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kitsuyui kitsuyui merged commit 1158740 into main Nov 13, 2022
@kitsuyui kitsuyui deleted the refactor branch November 13, 2022 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants