Skip to content

Instantly share code, notes, and snippets.

@aitor

aitor/ruby_hook.rb

Created Aug 26, 2019
Embed
What would you like to do?
# Trigger a travis build
post "/push-webhook" do
uri = URI.parse("https://api.travis-ci.org/repo/your-org/your-repo/requests")
request = Net::HTTP::Get.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Travis-API-Version"] = "3"
request["Authorization"] = "token your-token"
body = { "request" => { "branch" => "master" } }
request.body = body.to_json
response = http.request(request)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment