BigW Consortium Gitlab

build_policy.rb 319 Bytes
Newer Older
1 2
module Ci
  class BuildPolicy < CommitStatusPolicy
3 4
    condition(:protected_action) do
      next false unless @subject.action?
5

6
      !::Gitlab::UserAccess
7 8
        .new(@user, project: @subject.project)
        .can_merge_to_branch?(@subject.ref)
9
    end
10 11

    rule { protected_action }.prevent :update_build
12 13
  end
end