Skip to content

Commit

Permalink
Merge pull request #111 from github/jasonmacgowan/422
Browse files Browse the repository at this point in the history
Ignore adding team members that are not in the organization.
  • Loading branch information
jasonmacgowan authored Nov 13, 2024
2 parents 2276dca + a16e5b0 commit 84075b1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/entitlements/backend/github_team/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ def add_user_to_team(user:, team:, role: "member")
begin
result = octokit.add_team_membership(team.team_id, user, role:)
result[:state] == "active" || result[:state] == "pending"
rescue Octokit::UnprocessableEntity => e
raise e unless ignore_not_found && e.message =~ /Enterprise Managed Users must be part of the organization to be assigned to the team/

Entitlements.logger.warn "User #{user} not found in organization #{org}, ignoring."
false
rescue Octokit::NotFound => e
raise e unless ignore_not_found

Expand Down

0 comments on commit 84075b1

Please sign in to comment.