# File lib/travis/tools/github.rb, line 233 def with_otp(gh, user, otp, &block) gh = GH.with(gh.options.merge(:headers => { "X-GitHub-OTP" => otp })) if otp block.call(gh, otp) rescue GH::Error => error raise error unless error.info[:response_status] == 401 and error.info[:response_headers]['x-github-otp'].to_s =~ /required/ otp = ask_otp.arity == 0 ? ask_otp.call : ask_otp.call(user) retry end