Created
July 30, 2012 16:23
-
-
Save rkh/3208179 to your computer and use it in GitHub Desktop.
This file contains 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 'travis/support' | |
Travis::Amqp.connect | |
def as(user, &block) | |
Travis::Github.authenticated(User.find_by_login(user), &block) | |
end | |
def test_pr(owner, repo_name, id) | |
repo = Repository.find_by_owner_name_and_name(owner, repo_name) | |
user = repo.users.first | |
payload = { | |
:action => :opened, | |
:repository => GH["repos/#{owner}/#{repo_name}"].to_hash, | |
:pull_request => GH["repos/#{owner}/#{repo_name}/pulls/#{id}"].to_hash | |
} | |
data = { | |
:type => 'pull_request', | |
:credentials => { | |
:login => user.login, | |
:token => user.tokens.first.token | |
}, | |
:payload => payload.to_json, | |
:uuid => Travis.uuid.to_json | |
} | |
queue = Travis::Amqp::Publisher.builds('builds.requests') | |
queue.publish data, :type => 'request' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment