A tiny app to allow open-source contributors to opt-in to GitHub teams.
The #SquadGoals app provides an interface whereby community members can see a list of open GitHub teams, and provide them with the ability to freely join any team at the click of a button.
You'll need a few different credentials for things to work:
You'll need a dedicated "bot" account to add users to the organization:
- Create a bot account (a standard GitHub account not used by a human) that has admin rights to your organization.
- Create a personal access token for that user, with
admin:org
scope.
You'll also need to create an OAuth application to validate users:
- Create an OAuth application within your organization via
https://github.com/organizations/[YOUR-ORGANIZATION-NAME]/settings/applications/new
- The homepage URL should be the URL to your production instance.
- You can leave the callback URL blank. The default is fine.
- Create an OAuth app (see above)
- Create a personal access token for a user with admin rights to the organization (see above)
- Add
gem 'squad_gaols' to your project's Gemfile
- Add the following to your project's
config.ru
file:
require 'squad_goals'
run SquadGoals::App
The following environmental values should be set:
GITHUB_ORG_ID
- The name of the org to add users toGITHUB_CLIENT_ID
- Your OAuth app's client IDGITHUB_CLIENT_SECRET
- Your OAuth app's client secretGITHUB_TOKEN
- A personal access token for a user with admin rights to the organizationGITHUB_TEAMS
- Comma-separated list of team names you'd like to allow access to, e.g,red-team,blue-team
You'll also need an instance of Memecache running, to cache API calls. If using Herkou, this can be within memcachier's free use tier.
There are three views, success
, forbidden
, and error
. They're pretty boring by default, so you may want to swap them out for something a bit my snazzy. If you had a views directory along side your config.ru
, you can do so like this in your config.ru
file:
require 'squad_goals'
SquadGoals.views_dir = File.expand_path("./views", File.dirname(__FILE__))
run SquadGoals::App
These are just sinatra .erb
views. Take a look at the default views for an example.
You can also do the same with SquadGoals.public_dir
for serving static assets (AddToOrg comes bundled with Bootstrap by default).
require 'squad_goals'
SquadGoals.public_dir = File.expand_path("./public", File.dirname(__FILE__))
run SquadGoals::App