Created
April 5, 2012 06:06
-
-
Save treeder/2308369 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'cgi' | |
| require 'yaml' | |
| require 'hipchat-api' | |
| cgi_parsed = CGI::parse(payload) | |
| log "cgi_parsed: #{cgi_parsed.inspect}" | |
| parsed = JSON.parse(cgi_parsed['payload'][0]) | |
| log "parsed: #{parsed.inspect}" | |
| webhook_config = YAML.load_file('webhook_config.yml') | |
| log "webhook_config: #{webhook_config.inspect}" | |
| hipchat = HipChat::API.new(webhook_config['hipchat']['api_key']) | |
| parsed['commits'].each do |c| | |
| log hipchat.rooms_message(webhook_config['hipchat']['room'], 'WebhookWorkerNG', "Rev: <a href=\"#{c['url']}\">#{c['id'][0,9]}</a> - #{c['message']}", true).body | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'iron_worker_ng' | |
| require_relative '../../ruby/examples_helper' | |
| config = ExamplesHelper.load_config | |
| client = IronWorkerNG::Client.new(:token => config['iw']['token'], :project_id => config['iw']['project_id']) | |
| code = IronWorkerNG::Code::Ruby.new | |
| code.merge_worker 'github_to_hipchat_webhook_worker.rb' | |
| code.merge_file 'webhook_config.yml' | |
| code.merge_gem 'hipchat-api' | |
| client.codes.create(code) | |
| url = "https://worker-aws-us-east-1.iron.io/2/projects/#{config['iw']['project_id']}/tasks/webhook?code_name=#{code.name}&oauth=#{config['iw']['token']}" | |
| puts "Add this url to github Service Hooks, Post Receive URLs: " | |
| puts url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment