github-ops-app runs as a GitHub App installed on your organization. Create the app with the built-in installer, or by hand.
- Owner access to the GitHub organization
- The URL where GitHub can reach the service, for webhooks
The installer, from github-app-setup-go, creates the app from a manifest with the permissions and events below, then saves its credentials where the service reads them. The service loads them without a restart.
-
Configure the service without GitHub App credentials, and enable the installer:
APP_GITHUB_ORG=your-org GITHUB_APP_INSTALLER_ENABLED=true # where the credentials are saved: envfile (default) or aws-ssm STORAGE_MODE=envfile STORAGE_DIR=./.env # the external url of the service, including APP_BASE_PATH APP_PUBLIC_URL=https://github-ops.example.com
With
STORAGE_MODE=aws-ssm, also setAWS_SSM_PARAMETER_PREFIX, and setAPP_GITHUB_APP_ID,APP_GITHUB_APP_PRIVATE_KEY, andAPP_GITHUB_WEBHOOK_SECRETto the ARNs of the parameters the installer will create under that prefix, such asarn:aws:ssm:us-east-1:123456789012:parameter/github-ops-app/APP_GITHUB_APP_ID. -
Start the service. It serves the installer while it waits for credentials, and
/readyzreturns503until they load. -
Visit
https://github-ops.example.com/setup, check the webhook URL ends in/webhooks, and create the app. GitHub asks you to confirm. -
On the success page, follow the link to install the app on your organization.
-
Disable the installer: use the button on the success page, or unset
GITHUB_APP_INSTALLER_ENABLED.
Once an app is registered, the service refuses to exchange new installer
codes, so no one can replace its credentials. Still, only enable the
installer while you set the app up, and keep /setup off the public internet
if you can.
The installer saves the credentials under both the names github-app-setup-go
uses, such as GITHUB_APP_ID, and the names this service reads, such as
APP_GITHUB_APP_ID.
-
Go to
https://github.com/organizations/YOUR_ORG/settings/apps/new. -
Fill in:
Field Value GitHub App name github-ops-app(must be unique)Homepage URL Your organization's or the repo URL Webhook URL https://YOUR_HOST/webhooksWebhook secret A long random string; save it Where can this GitHub App be installed? Only on this account -
Set the permissions and events below.
-
Click Create GitHub App, and note the App ID.
assets/github/manifest.json holds the same settings as a manifest.
Under Private keys, click Generate a private key and keep the .pem
file secret.
Click Install App, choose your organization, and give it access to all repositories, or the ones whose PRs and alerts it should check.
APP_GITHUB_ORG=your-org
APP_GITHUB_APP_ID=123456
APP_GITHUB_WEBHOOK_SECRET=your-webhook-secret
# the private key: a file, the pem itself, or an ssm parameter arn
APP_GITHUB_APP_PRIVATE_KEY_PATH=/path/to/private-key.pem
# APP_GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
# APP_GITHUB_APP_PRIVATE_KEY=arn:aws:ssm:us-east-1:123456789012:parameter/github-ops-app/private-keyThe installation ID is looked up from the organization. To skip the lookup,
set APP_GITHUB_INSTALLATION_ID to the number at the end of the installation
page's URL, https://github.com/organizations/YOUR_ORG/settings/installations/12345678.
The app needs these permissions and no others. Grant only those of the features you use, if you prefer.
| Permission | Access | Used for |
|---|---|---|
| Administration | Read | PR compliance: branch protection rules |
| Checks | Read | PR compliance: check runs on the merged commit |
| Commit statuses | Read | PR compliance: statuses on the merged commit |
| Metadata | Read | PR compliance: rulesets and merger's role |
| Pull requests | Read | PR compliance: PRs and their reviews |
| Code scanning alerts | Read | Security alerts |
| Dependabot alerts | Read | Security alerts |
| Secret scanning alerts | Read | Security alerts |
| Permission | Access | Used for |
|---|---|---|
| Members | Read/Write | Okta sync: teams and team membership |
Without Administration: read, the PR compliance check cannot read branch
protection, and fails with a 403 instead of silently treating the branch as
unprotected.
| Event | Used for |
|---|---|
| Pull request | PR compliance |
| Team | Okta sync after a team is created, renamed, or deleted outside Okta |
| Membership | Okta sync after a team's members change outside Okta |
The service answers GitHub's ping event, and accepts and ignores events it
doesn't handle and events from other organizations.
- In the app's settings, open Advanced → Recent Deliveries; the
pingdelivery should have succeeded. - Merge a PR into a monitored branch and check the service's logs.
- With the admin token set, call
GET /server/status.
APP_GITHUB_WEBHOOK_SECRETmust match the app's webhook secret exactly.
- Check the app has the permissions above. After changing them, an organization owner must approve them on the installation.
- Check the app is installed on
APP_GITHUB_ORGand can access the repository.
- Install the app on
APP_GITHUB_ORG, or setAPP_GITHUB_INSTALLATION_ID.
- Check the webhook URL is reachable from the internet and ends in
/webhooks, after anyAPP_BASE_PATH. - Review Recent Deliveries for the response GitHub got.