Skip to content

Instantly share code, notes, and snippets.

@aitor
Created August 26, 2019 08:04
Show Gist options
  • Save aitor/beef09dd94f9d80a180457feba6c2ed0 to your computer and use it in GitHub Desktop.
Save aitor/beef09dd94f9d80a180457feba6c2ed0 to your computer and use it in GitHub Desktop.
# 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