Class: Ci::ExternalPullRequest
Constant Summary
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Class Method Summary
collapse
Instance Method Summary
collapse
model_name, table_name_prefix
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Class Method Details
.create_or_update_from_params(params) ⇒ Object
48
49
50
51
52
53
54
|
# File 'app/models/ci/external_pull_request.rb', line 48
def self.create_or_update_from_params(params)
find_params = params.slice(:project_id, :source_branch, :target_branch)
safe_find_or_initialize_and_update(find: find_params, update: params) do |pull_request|
yield(pull_request) if block_given?
end
end
|
Instance Method Details
#actual_branch_head? ⇒ Boolean
56
57
58
|
# File 'app/models/ci/external_pull_request.rb', line 56
def actual_branch_head?
actual_source_branch_sha == source_sha
end
|
#from_fork? ⇒ Boolean
60
61
62
|
# File 'app/models/ci/external_pull_request.rb', line 60
def from_fork?
source_repository != target_repository
end
|
#modified_paths ⇒ Object
80
81
82
|
# File 'app/models/ci/external_pull_request.rb', line 80
def modified_paths
project.repository.diff_stats(target_sha, source_sha).paths
end
|
#predefined_variables ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
|
# File 'app/models/ci/external_pull_request.rb', line 68
def predefined_variables
Gitlab::Ci::Variables::Collection.new.tap do |variables|
variables.append(key: 'CI_EXTERNAL_PULL_REQUEST_IID', value: pull_request_iid.to_s)
variables.append(key: 'CI_EXTERNAL_PULL_REQUEST_SOURCE_REPOSITORY', value: source_repository)
variables.append(key: 'CI_EXTERNAL_PULL_REQUEST_TARGET_REPOSITORY', value: target_repository)
variables.append(key: 'CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_SHA', value: source_sha)
variables.append(key: 'CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_SHA', value: target_sha)
variables.append(key: 'CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME', value: source_branch)
variables.append(key: 'CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME', value: target_branch)
end
end
|
#source_ref ⇒ Object
64
65
66
|
# File 'app/models/ci/external_pull_request.rb', line 64
def source_ref
Gitlab::Git::BRANCH_REF_PREFIX + source_branch
end
|