Sha256: ed273c6c37a4e0bbd237804fc76b8ef80558ab5c4923c63b1db91943afc79e78
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'octokit' require 'hybrid_platforms_conductor/credentials' module HybridPlatformsConductor # Mixin used to access Github API module Github include Credentials # Iterate over each Github repository # # Parameters:: # * Proc: Code called for each Github repository: # * Parameters:: # * *github* (Octokit::Client): The client instance accessing the Github API # * *repo_info* (Hash<Symbol, Object>): The repository info: # * *name* (String): Repository name. # * *slug* (String): Repository slug. def for_each_github_repo @config.known_github_repos.each do |repo_info| Octokit.configure do |c| c.api_endpoint = repo_info[:url] end with_credentials_for(:github, resource: repo_info[:url]) do |_github_user, github_token| client = Octokit::Client.new(access_token: github_token) (repo_info[:repos] == :all ? client.repositories(repo_info[:user]).map { |repo| repo[:name] } : repo_info[:repos]).each do |name| yield client, { name: name, slug: "#{repo_info[:user]}/#{name}" } end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hybrid_platforms_conductor-33.4.0 | lib/hybrid_platforms_conductor/github.rb |