diff options
Diffstat (limited to 'lib/gitlab/badge/pipeline/status.rb')
-rw-r--r-- | lib/gitlab/badge/pipeline/status.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/badge/pipeline/status.rb b/lib/gitlab/badge/pipeline/status.rb index 17f179f027d..f061ba22688 100644 --- a/lib/gitlab/badge/pipeline/status.rb +++ b/lib/gitlab/badge/pipeline/status.rb @@ -12,6 +12,7 @@ module Gitlab def initialize(project, ref, opts: {}) @project = project @ref = ref + @ignore_skipped = Gitlab::Utils.to_boolean(opts[:ignore_skipped], default: false) @customization = { key_width: opts[:key_width].to_i, key_text: opts[:key_text] @@ -26,9 +27,11 @@ module Gitlab # rubocop: disable CodeReuse/ActiveRecord def status - @project.ci_pipelines + pipelines = @project.ci_pipelines .where(sha: @sha) - .latest_status(@ref) || 'unknown' + + relation = @ignore_skipped ? pipelines.without_statuses([:skipped]) : pipelines + relation.latest_status(@ref) || 'unknown' end # rubocop: enable CodeReuse/ActiveRecord |