Skip to content

Instantly share code, notes, and snippets.

@aitor
Created August 26, 2019 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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