Sha256: c212f8c7eecd904fb38922bf43f0b4788a38daa6c112f0e52ea746d83899ec98
Contents?: true
Size: 939 Bytes
Versions: 2
Compression:
Stored size: 939 Bytes
Contents
module AddToOrg module Helpers # query api for the user's verified emails def verified_emails emails = client.emails :accept => 'application/vnd.github.v3' emails.select { |email| email.verified } end def valid? AddToOrg.validator.call(github_user, verified_emails, client) end private # user client def client @client ||= Octokit::Client.new :access_token => github_user.token end # org admin client def sudo_client @sudo_client ||= Octokit::Client.new :access_token => ENV['GITHUB_TOKEN'] end # true if user is already a member of the org def member? client.organization_member? org_id, github_user.login end def team_id ENV['GITHUB_TEAM_ID'] end def org_id ENV['GITHUB_ORG_ID'] end # the main event... def add sudo_client.add_team_membership team_id, github_user.login end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
add-to-org-3.0.1 | lib/add-to-org/helpers.rb |
add-to-org-3.0.0 | lib/add-to-org/helpers.rb |