Skip to content
GitAudience

GitHub App

.md

Connect a GitHub account to GitAudience with a private GitHub App, install it on the repositories you follow, and disconnect it.

GitAudience reads GitHub through a private GitHub App that it creates for you, one per GitHub account: an organization or a personal account. The App lives on that account, and its keys stay on your instance. GitAudience never uses a GitHub App to sign anyone in.

Example: the projects acme/orbit and acme/beacon both use the App of the acme organization. A project on jdoe/notes needs a second App, on the personal account jdoe.

Where it is in the console

  • When you add a project, the first step, Repository, connects the account if it has no App yet. See Add a project.
  • Settings › GitHub Apps lists the Apps of the instance and connects more accounts. This section is the same for every project: it belongs to the instance. It is also at /settings/github.
Settings › GitHub Apps with the App of the acme organization connected, two attached projects acme/orbit and acme/beacon, and the Connect a GitHub account form below
Settings › GitHub Apps with the App of the acme organization connected, two attached projects acme/orbit and acme/beacon, and the Connect a GitHub account form below

The list has one row per account:

ColumnWhat it shows
GitHub accountThe account login, with Organization or Personal account.
StatusConnected, Not installed, Creating… or Failed, and the number of open alerts.
Attached projectsThe projects whose repository belongs to this account.

Owners also see Install on GitHub (App created but not installed), Manage on GitHub and Disconnect.

Permissions and why

The App asks GitHub for two repository permissions and subscribes to no event:

PermissionAccessWhy
MetadataReadRead the repository: its ID, name, owner, visibility and star count.
ContentsWriteList the stargazers of the repository.

GitHub only lists the stargazers of a repository to someone who has write access to its contents, and refuses with Metadata or Contents in read only. GitAudience uses this permission only to read stargazers, and never writes to your repository.

Each sync asks GitHub for a short-lived installation token limited to the project’s repository, uses it, then forgets it: tokens are never stored, put in task data or logged. Reading public metadata, for example of a competing repo, uses a token with Metadata read only.

How the App is created

GitAudience creates the App with a GitHub App manifest: you confirm the creation on GitHub, and GitHub sends the App’s keys back to your instance.

  1. Choose the account

    In Settings › GitHub Apps, under Connect a GitHub account, pick GitHub organization or Personal GitHub account. In Repository in this GitHub account, type a repository of that account, like acme/orbit: GitAudience takes the account from it. Click Connect on GitHub.

  2. Create the App on GitHub

    GitHub opens its page for a new App, already filled in: the name GitAudience <account>, private, with the two permissions above. Confirm the creation.

    For an organization, you must be an owner of the organization or a GitHub App manager. Otherwise GitHub doesn’t create the App.

  3. Wait a few seconds

    GitHub sends you back to GitAudience. The row shows Creating… while the worker finishes: it fetches the App’s keys from GitHub and stores them encrypted.

  4. Install the App

    Click Install on GitHub. Choose Only select repositories and pick the public repositories you want to follow. GitHub sends you back to GitAudience, which reads the installation.

The return from GitHub goes to the address in PUBLIC_URL, so that variable must be the address you open the console with. See Installation.

Note

The App’s private key, client secret and webhook secret are encrypted with SECRET_KEY, which the API and worker share. If you lose or change SECRET_KEY, the worker can no longer read them: its log names the cause, and the fix is to disconnect the App and create it again.

When creation fails

What you seeWhat happenedWhat to do
Failed, and the App not created alertGitHub didn’t create the App, or the worker failed three times to fetch its keys.Check your rights on the account, then start again.
“The GitHub App was created on a different account than expected.”The App was created on another account than the one you chose.Delete that App on GitHub, then start again.
“A GitHub App is already connected for this account.”The account already has an App.Use it, or disconnect it first.
“The GitHub App is being created. Wait a moment, then reload the page.”A creation for this account is already under way.Wait. A creation that hasn’t finished after an hour no longer counts, and you can start again.

Installation

GitAudience needs the App installed with Only select repositories, with the project’s repository among the selected ones. It doesn’t accept All repositories.

Installation stateWhat happens
Only select repositories, repository selectedProjects can be created and synced.
All repositoriesThe Installation to fix alert shows. Creating a project and Sync now are refused (“The GitHub App must be installed on selected repositories only.”), and the sync reads nothing. Switch the installation back to Only select repositories on GitHub.
Suspended on GitHubThe Installation suspended alert shows and the sync reads nothing until you reactivate it on GitHub.
Repository not selectedThe repository can’t be picked when you add a project. Add it to the installation on GitHub, then click Refresh list.

To follow another repository of the same account, add it to the existing installation on GitHub, then add the project in GitAudience: there is no second App to create.

GitAudience reads the installations every day and after each return from GitHub. When you add a project, Refresh list reads them again.

API budget

GitHub limits API requests per installation. GitAudience counts that budget per installation, so projects of the same account share it, and a project on another account has its own. See Stargazer sync.

Disconnecting an App

Owners disconnect an App from Settings › GitHub Apps with Disconnect. The confirmation, Disconnect GitHub App for acme?, lists the projects whose sync will pause.

Disconnecting:

  • removes the App’s keys and installations from the instance, and its alerts;
  • keeps the projects of that account and all their data;
  • pauses their sync. Settings › General of each project then says “The GitHub App for acme is disconnected”, and Sync now is disabled.

It doesn’t remove the App from GitHub: uninstall or delete it there if you want.

Connecting a new App on the same account later attaches its projects again at once, even if the account changed its login on GitHub in between: GitAudience matches the account by its numeric GitHub ID.

Permissions in GitAudience

Only owners connect, install, refresh and disconnect Apps. Members see the list. On the demo instance, no App is installed.