diff options
Diffstat (limited to 'app/workers/jira_connect/sync_branch_worker.rb')
-rw-r--r-- | app/workers/jira_connect/sync_branch_worker.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/workers/jira_connect/sync_branch_worker.rb b/app/workers/jira_connect/sync_branch_worker.rb new file mode 100644 index 00000000000..8c3416478fd --- /dev/null +++ b/app/workers/jira_connect/sync_branch_worker.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module JiraConnect + class SyncBranchWorker # rubocop:disable Scalability/IdempotentWorker + include ApplicationWorker + + queue_namespace :jira_connect + feature_category :integrations + loggable_arguments 1, 2 + + def perform(project_id, branch_name, commit_shas) + project = Project.find_by_id(project_id) + + return unless project + + branches = [project.repository.find_branch(branch_name)] if branch_name.present? + commits = project.commits_by(oids: commit_shas) if commit_shas.present? + + JiraConnect::SyncService.new(project).execute(commits: commits, branches: branches) + end + end +end |