This is a webhook that intends to allow users to escalate to organizational admin within your GitHub organization for a temporary amount of time. Indent currently only has an integration for escalating to certain teams, which didn't fit our needs perfectly.
This webhook requires you to create a GitHub app, and install it on your organization account, as the members
endpoint isn't accessible via PAT (personal access token).
- Under your organization settings in GitHub, scroll to the bottom of the page and find "GitHub Apps" under the Developer settings drop-down. Click on "GitHub Apps".
- Click "New GitHub App", located on the top right-hand side.
- Name the GitHub app something unique - e.g. "My Organization Indent Org Admin"
- Fill in the homepage URL with something - does not particularly matter what you set it to. I personally set it to our corporate website.
- Unclick "Active" under the Webhook header.
- Scroll to the "Permissions" section, and expand the Organization Permissions dropdown. Within this dropdown, scroll to "Members", and set the access to "Access: Read/Write".
- Scroll to the bottom, and ensure that "Only on this account" is checked under "Where can this GitHub app be installed?"
- Click "Create GitHub App".
- Make note of the "App ID". You'll need this for later.
- Scroll down to the bottom of the page you were just redirected to, and click "Generate a private key". This will generate a new private key necessary for this webhook's operation.
- Next, scroll up to the top of the page, and click "Install App" on the left-hand side of the page. Next to your organization name, click "Install". This will then prompt you to confirm your action - go ahead and click "Install".
- Next, take note of the URL you're currently at. It should be of the format
https://github.com/organizations/(my-org-slug)/settings/installations/(installation-id)
. Take note of this numeric "installation id" as you'll need it later. - All done!
This webhook is designed to be deployed on Cloudflare Workers, however, you can easily adapt this code to run on Lambda or your favorite serverless runtime as necessary. This guide assumes that you're using Cloudflare Workers.
-
First, convert the GitHub private key from PKCS#8 to PKCS#1 using the command:
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in (your_private_key).pem -out indent-org-mgmt.key
Copy down this private key, as you'll need it in one second.
-
Ensure that the
wrangler
CLI utility is installed & that you're authenticated with your Cloudflare account. -
Copy
wrangler.example.toml
towrangler.toml
, and fill in the placeholder values within the configuration file. -
Next, run
npm i
(orpnpm i
if you're usingpnpm
) to install all dependencies. -
Run
npm run deploy
, and take note of the URL thatwrangler
says that your webhook has been deployed to. -
Next, run
wrangler secret put GITHUB_APP_PRIVATE_KEY
and paste in the private key you converted in the first command. -
All done!
We need to create a dummy resource so that Indent knows that we are adding GitHub organizations to the application. You can delete this after you install the webhook integration.
- In the admin panel under Indent, click the "Resources" option on the left-hand side of the screen.
- Click "New" at the top-right of the screen.
- Fill in the resource modal like so:
- Click "Create Resource"
- In the admin panel under Indent, click the "Integrations" option on the left-hand side of the screen.
- Find the "Webhooks" panel, and then click on it. Click "Create Webhook"
- Check "Pull Update" & "Apply Update", and set the resources to "Github Organization".
- Fill in the Webhook URL with the webhook URL
wrangler
gave you, and click "Show" on the Signing Secret. Copy this, as you'll need it in a second. - Click "Create Webhook".
- Next, go back to the terminal that you deployed the webhook through, and run
wrangler secret put INDENT_WEBHOOK_SECRET
. Paste in the signing secret you copied in the previous step. - Go back to the admin panel under Indent, and go to Resources. Click "Pull from Integrations", and check GitHub Organizations. If you set everything up correctly, your GitHub organization should pop up as a resource in Indent.
- All done!
This step is necessary, as Indent will not route any access request approvals to your webhook by default, leading to some odd behavior. Learn from me - I had to figure this out using the support chat.
- In the admin panel under Indent, go to the Admin tab. Then, click "Add Rule" under "Access Request Rules".
- Fill in the rule like so, where
GH Org Webhook
is the name of the webhook you created above, andhatf0
is replaced by the users that you want to approve any requests to become an organization owner. - Click "Save" at the top right of the page. This Indent integration is now fully configured.
Contributions are welcome! Please make sure that your code is linted before contributing to this repo.