Sha256: 384c5ab02c204ba59dde7b677d8e14b90042fd7e6715677bebc68d9c69d4c021

Contents?: true

Size: 737 Bytes

Versions: 6

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

require 'travis/pro'
require 'travis/tools/github'
require 'highline/import' # so we can hide the password

github_token = ask('GitHub token: ')

# Set up GitHub tool for doing the login handshake.
github = Travis::Tools::Github.new(drop_token: true) do |g|
  g.github_token = github_token
end

# Create temporary GitHub token and use it to authenticate against Travis CI.
github.with_token do |token|
  Travis::Pro.github_auth(token)
end

# Look up the current user.
user = Travis::Pro::User.current
puts "Hello #{user.login}!"

# Display repositories the user is a member of.
repos = Travis::Pro::Repository.find_all(member: user.login)
repos.each { |repo| puts "#{repo.slug} #{repo.last_build_state}" }

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
travis-1.14.0 examples/pro_auth.rb
travis-1.13.3 examples/pro_auth.rb
travis-1.13.2 examples/pro_auth.rb
travis-1.13.1 examples/pro_auth.rb
travis-1.13.0 examples/pro_auth.rb
travis-1.12.0 examples/pro_auth.rb