Class: Txgh::Handlers::Github::PushHandler
- Defined in:
- lib/txgh/handlers/github/push_handler.rb
Instance Attribute Summary
Attributes inherited from Handler
#logger, #payload, #project, #repo
Instance Method Summary collapse
Methods inherited from Handler
Constructor Details
This class inherits a constructor from Txgh::Handlers::Github::Handler
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/txgh/handlers/github/push_handler.rb', line 8 def execute # Check if the branch in the hook data is the configured branch we want logger.info("request github branch: #{branch}") logger.info("config github branch: #{repo.github_config_branch}") if repo.should_process_ref?(branch) logger.info('found branch in github request') tx_resources = tx_resources_for(branch) modified_resources = added_and_modified_resources_for(tx_resources) modified_resources.merge!(l10n_resources_for(tx_resources)) if repo.github_config_branch.include?('tags/') modified_resources.merge!(tag_resources_for(tx_resources)) end # Handle DBZ 'L10N' special case if branch.include?("L10N") logger.info('processing L10N tag') # Create a new branch off tag commit if branch.include?('tags/L10N') repo.api.create_ref(repo.name, 'heads/L10N', payload['head_commit']['id']) end end updater = ResourceUpdater.new(project, repo, logger) categories = { 'author' => payload['head_commit']['committer']['name'] } modified_resources.each_pair do |resource, commit_sha| updater.update_resource(resource, commit_sha, categories) end end respond_with(200, true) end |