Welcome to mirror list, hosted at ThFree Co, Russian Federation.

create_commit_service.rb « ci « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 479a2d6defc5e28b722512d02d9621178f83c8bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Ci
  class CreateCommitService
    def execute(project, user, params)
      sha = params[:checkout_sha] || params[:after]
      origin_ref = params[:ref]
      
      unless origin_ref && sha.present?
        return false
      end

      ref = origin_ref.gsub(/\Arefs\/(tags|heads)\//, '')

      # Skip branch removal
      if sha == Ci::Git::BLANK_SHA
        return false
      end

      tag = origin_ref.start_with?('refs/tags/')
      commit = project.gl_project.ensure_ci_commit(sha)
      unless commit.skip_ci?
        commit.update_committed!
        commit.create_builds(ref, tag, user)
      end

      commit
    end
  end
end