Class: Overlay::GithubController

Inherits:
ApplicationController show all
Defined in:
app/controllers/overlay/github_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/overlay/github_controller.rb', line 5

def update
  render nothing: true

  Overlay.configuration.repositories.each do |repo_config|
    next unless repo_config.class == GithubRepo
    branch = repo_config[:branch] || 'master'

    if (params[:repository] && params[:ref])
      if (params[:repository][:name] == repo_config[:repo]) && (params[:ref] == "refs/heads/#{branch}")
        logger.info "Enqueueing GithubJob for repo: #{repo_config[:repo]} and branch: #{repo_config[:branch] || 'master'}"
        GithubJob.new.async.perform repo_config
      end
    end
  end
end