No description
  • Ruby 96.1%
  • Shell 3.8%
  • Dockerfile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
nobe4 03740a8f76
Merge pull request #288 from github/422
fix(github_org): handle 422 in a nicer way
2026-07-21 14:52:24 +02:00
.github build(deps): bump ruby/setup-ruby in the github-actions group 2026-07-14 21:03:20 +00:00
bin entitlements-github-plugin 2022-06-07 12:17:36 -04:00
lib fix(github_org): handle 422 in a nicer way 2026-07-17 16:17:18 +02:00
script update bootstrap and test scripts 2024-04-03 14:16:21 -06:00
spec fix(github_org): handle 422 in a nicer way 2026-07-17 16:17:18 +02:00
vendor/cache build(deps-dev): bump rack from 3.1.21 to 3.2.6 2026-07-21 07:09:10 +00:00
.gitignore update gitignore file 2024-04-03 14:27:31 -06:00
.rubocop.yml update dep pins 2024-04-03 14:05:48 -06:00
.ruby-version bundle update --all 2024-12-18 13:38:53 -05:00
entitlements-github-plugin.gemspec Bump the dev-ruby-dependencies group across 1 directory with 6 updates 2025-11-10 21:29:40 +00:00
Gemfile entitlements-github-plugin 2022-06-07 12:17:36 -04:00
Gemfile.lock Merge branch 'main' into 422 2026-07-21 09:18:27 +02:00
LICENSE add MIT license 2022-06-07 10:22:46 -06:00
README.md Document ignore_not_found configuration option 2023-12-14 15:12:04 -05:00

entitlements-github-plugin

acceptance test lint release build coverage style

entitlements-github-plugin is an entitlements-app plugin allowing entitlements configs to be used to manage membership of GitHub.com Organizations and Teams.

Usage

Your entitlements-app config config/entitlements.yaml runs through ERB interpretation automatically. You can extend your entitlements configuration to load plugins like so:

<%-
  unless ENV['CI_MODE']
    begin
      require_relative "/data/entitlements/lib/entitlements-and-plugins"
    rescue Exception
      begin
        require_relative "lib/entitlements-and-plugins"
      rescue Exception
        # We might not have the plugins installed and still want this file to be
        # loaded. Don't raise anything but silently fail.
      end
    end
  end
-%>

You can then define lib/entitlements-and-plugins like so:

#!/usr/bin/env ruby
# frozen_string_literal: true

ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", File.dirname(__FILE__))
require "bundler/setup"
require "entitlements"

# require entitlements plugins here
require "entitlements/backend/github_org"
require "entitlements/backend/github_team"
require "entitlements/service/github"

Any plugins defined in lib/entitlements-and-plugins will be loaded and used at entitlements-app runtime.

Features

Org Team

entitlements-github-plugin manages org team membership to two roles - admin and member. Your entitlements-app config config/entitlements.yaml is used to configure the location for the declarations of this membership.

  github.com/github/org:
    addr: <%= ENV["GITHUB_API_BASE"] %>
    base: ou=org,ou=github,ou=GitHub,dc=github,dc=com
    dir: github.com/github/org
    org: github
    token: <%= ENV["GITHUB_ORG_TOKEN"] %>
    ignore_not_found: false # optional argument to ignore users who are not found in the GitHub instance
    type: "github_org"

entitlements-github-plugin will look in the defined location above, github.com/github/org, for admin.txt and member.txt defining the respective membership for each role.

GitHub Teams

entitlements-github-plugin manages membership for all teams listed in the defined subfolder. The plugin will use extension-less name of the file as the team name. GitHub Team management can be configured like so:

  github.com/github/teams:
    addr: <%= ENV["GITHUB_API_BASE"] %>
    base: ou=teams,ou=github,ou=GitHub,dc=github,dc=com
    dir: github.com/github/teams
    org: github
    token: <%= ENV["GITHUB_ORG_TOKEN"] %>
    ignore_not_found: false # optional argument to ignore users who are not found in the GitHub instance
    type: "github_team"

For example, if there were a file github.com/github/teams/new-team.txt with a single user inside, a GitHub.com Team would be created in the github org with the name new-team.

Metadata

Entitlements configs can contain metadata which the plugin will use to make further configuration decisions.

metadata_parent_team_name - when defined in an entitlements config, the defined team will be made the parent team of this GitHub.com Team.

Release 🚀

To release a new version of this Gem, do the following:

  1. Update the version number in the lib/version.rb file
  2. Run bundle install to update the Gemfile.lock file with the new version
  3. Commit your changes, push them to GitHub, and open a PR

Once your PR is approved and the changes are merged, a new release will be created automatically by the release.yml workflow. The latest version of the Gem will be published to the GitHub Package Registry and RubyGems.