Module: Samsao::Actions
- Included in:
- Danger::DangerSamsao
- Defined in:
- lib/samsao/actions.rb
Overview
Actions mixin module
Instance Method Summary collapse
-
#fail_when_changelog_update_missing ⇒ void
Fails when CHANGELOG is not updated on feature or fix branches.
-
#fail_when_merge_commit_detected ⇒ void
Fails when one or more merge commit is detected.
-
#fail_when_non_single_commit_feature ⇒ void
Fails when a feature branch have than one commit.
-
#fail_when_wrong_branching_model ⇒ void
Fails when git branching model is not respected for PR branch name.
-
#warn_when_work_in_progess_pr ⇒ void
Fails when CHANGELOG is not updated on feature or fix branches.
Instance Method Details
#fail_when_changelog_update_missing ⇒ void
This method returns an undefined value.
Fails when CHANGELOG is not updated on feature or fix branches
26 27 28 29 30 31 |
# File 'lib/samsao/actions.rb', line 26 def fail_when_changelog_update_missing return if trivial_change? return if support_branch? && config.project_type == :application fail 'You did a change without updating CHANGELOG file!' unless changelog_modified? end |
#fail_when_merge_commit_detected ⇒ void
This method returns an undefined value.
Fails when one or more merge commit is detected.
36 37 38 39 40 41 |
# File 'lib/samsao/actions.rb', line 36 def fail_when_merge_commit_detected = 'Some merge commits were detected, you must use rebase to sync with base branch.' merge_commit_detector = /^Merge branch '#{github.branch_for_base}'/ fail if git.commits.any? { |commit| commit. =~ merge_commit_detector } end |
#fail_when_non_single_commit_feature ⇒ void
This method returns an undefined value.
Fails when a feature branch have than one commit
16 17 18 19 20 21 |
# File 'lib/samsao/actions.rb', line 16 def fail_when_non_single_commit_feature commit_count = git.commits.size = "Your feature branch should have a single commit but found #{commit_count}, squash them together!" fail if feature_branch? && commit_count > 1 end |
#fail_when_wrong_branching_model ⇒ void
This method returns an undefined value.
Fails when git branching model is not respected for PR branch name.
7 8 9 10 11 |
# File 'lib/samsao/actions.rb', line 7 def fail_when_wrong_branching_model = 'Your branch should be prefixed with feature/, fix/, bugfix/, hotfix/, release/ or support/!' fail unless respects_branching_model end |
#warn_when_work_in_progess_pr ⇒ void
This method returns an undefined value.
Fails when CHANGELOG is not updated on feature or fix branches
46 47 48 49 50 |
# File 'lib/samsao/actions.rb', line 46 def warn_when_work_in_progess_pr = 'Do not merge, PR is a work in progess [WIP]!' warn if github.pr_title.include?('[WIP]') end |